@metamask/bridge-status-controller 73.0.0 → 74.0.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.
- package/CHANGELOG.md +20 -1
- package/dist/bridge-status-controller.cjs +167 -21
- package/dist/bridge-status-controller.cjs.map +1 -1
- package/dist/bridge-status-controller.d.cts +6 -1
- package/dist/bridge-status-controller.d.cts.map +1 -1
- package/dist/bridge-status-controller.d.mts +6 -1
- package/dist/bridge-status-controller.d.mts.map +1 -1
- package/dist/bridge-status-controller.mjs +167 -21
- package/dist/bridge-status-controller.mjs.map +1 -1
- package/dist/constants.cjs +1 -0
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +1 -0
- package/dist/constants.mjs.map +1 -1
- package/dist/index.cjs +12 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -1
- package/dist/quote-status-manager/constants.cjs +181 -0
- package/dist/quote-status-manager/constants.cjs.map +1 -0
- package/dist/quote-status-manager/constants.d.cts +137 -0
- package/dist/quote-status-manager/constants.d.cts.map +1 -0
- package/dist/quote-status-manager/constants.d.mts +137 -0
- package/dist/quote-status-manager/constants.d.mts.map +1 -0
- package/dist/quote-status-manager/constants.mjs +178 -0
- package/dist/quote-status-manager/constants.mjs.map +1 -0
- package/dist/quote-status-manager/errors.cjs +51 -0
- package/dist/quote-status-manager/errors.cjs.map +1 -0
- package/dist/quote-status-manager/errors.d.cts +45 -0
- package/dist/quote-status-manager/errors.d.cts.map +1 -0
- package/dist/quote-status-manager/errors.d.mts +45 -0
- package/dist/quote-status-manager/errors.d.mts.map +1 -0
- package/dist/quote-status-manager/errors.mjs +46 -0
- package/dist/quote-status-manager/errors.mjs.map +1 -0
- package/dist/quote-status-manager/quote-status-api-service.cjs +241 -0
- package/dist/quote-status-manager/quote-status-api-service.cjs.map +1 -0
- package/dist/quote-status-manager/quote-status-api-service.d.cts +93 -0
- package/dist/quote-status-manager/quote-status-api-service.d.cts.map +1 -0
- package/dist/quote-status-manager/quote-status-api-service.d.mts +93 -0
- package/dist/quote-status-manager/quote-status-api-service.d.mts.map +1 -0
- package/dist/quote-status-manager/quote-status-api-service.mjs +237 -0
- package/dist/quote-status-manager/quote-status-api-service.mjs.map +1 -0
- package/dist/quote-status-manager/quote-status-entry-store.cjs +271 -0
- package/dist/quote-status-manager/quote-status-entry-store.cjs.map +1 -0
- package/dist/quote-status-manager/quote-status-entry-store.d.cts +144 -0
- package/dist/quote-status-manager/quote-status-entry-store.d.cts.map +1 -0
- package/dist/quote-status-manager/quote-status-entry-store.d.mts +144 -0
- package/dist/quote-status-manager/quote-status-entry-store.d.mts.map +1 -0
- package/dist/quote-status-manager/quote-status-entry-store.mjs +267 -0
- package/dist/quote-status-manager/quote-status-entry-store.mjs.map +1 -0
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.cjs +29 -0
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.cjs.map +1 -0
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.d.cts +32 -0
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.d.cts.map +1 -0
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.d.mts +32 -0
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.d.mts.map +1 -0
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.mjs +25 -0
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.mjs.map +1 -0
- package/dist/quote-status-manager/quote-status-state-fsm.cjs +107 -0
- package/dist/quote-status-manager/quote-status-state-fsm.cjs.map +1 -0
- package/dist/quote-status-manager/quote-status-state-fsm.d.cts +57 -0
- package/dist/quote-status-manager/quote-status-state-fsm.d.cts.map +1 -0
- package/dist/quote-status-manager/quote-status-state-fsm.d.mts +57 -0
- package/dist/quote-status-manager/quote-status-state-fsm.d.mts.map +1 -0
- package/dist/quote-status-manager/quote-status-state-fsm.mjs +103 -0
- package/dist/quote-status-manager/quote-status-state-fsm.mjs.map +1 -0
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.cjs +27 -0
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.cjs.map +1 -0
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.d.cts +30 -0
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.d.cts.map +1 -0
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.d.mts +30 -0
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.d.mts.map +1 -0
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.mjs +23 -0
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.mjs.map +1 -0
- package/dist/quote-status-manager/quotes-status-manager.cjs +477 -0
- package/dist/quote-status-manager/quotes-status-manager.cjs.map +1 -0
- package/dist/quote-status-manager/quotes-status-manager.d.cts +124 -0
- package/dist/quote-status-manager/quotes-status-manager.d.cts.map +1 -0
- package/dist/quote-status-manager/quotes-status-manager.d.mts +124 -0
- package/dist/quote-status-manager/quotes-status-manager.d.mts.map +1 -0
- package/dist/quote-status-manager/quotes-status-manager.mjs +473 -0
- package/dist/quote-status-manager/quotes-status-manager.mjs.map +1 -0
- package/dist/quote-status-manager/types.cjs +8 -0
- package/dist/quote-status-manager/types.cjs.map +1 -0
- package/dist/quote-status-manager/types.d.cts +145 -0
- package/dist/quote-status-manager/types.d.cts.map +1 -0
- package/dist/quote-status-manager/types.d.mts +145 -0
- package/dist/quote-status-manager/types.d.mts.map +1 -0
- package/dist/quote-status-manager/types.mjs +6 -0
- package/dist/quote-status-manager/types.mjs.map +1 -0
- package/dist/quote-status-manager/utils.cjs +11 -0
- package/dist/quote-status-manager/utils.cjs.map +1 -0
- package/dist/quote-status-manager/utils.d.cts +7 -0
- package/dist/quote-status-manager/utils.d.cts.map +1 -0
- package/dist/quote-status-manager/utils.d.mts +7 -0
- package/dist/quote-status-manager/utils.d.mts.map +1 -0
- package/dist/quote-status-manager/utils.mjs +7 -0
- package/dist/quote-status-manager/utils.mjs.map +1 -0
- package/dist/quote-status-manager/validators.cjs +44 -0
- package/dist/quote-status-manager/validators.cjs.map +1 -0
- package/dist/quote-status-manager/validators.d.cts +172 -0
- package/dist/quote-status-manager/validators.d.cts.map +1 -0
- package/dist/quote-status-manager/validators.d.mts +172 -0
- package/dist/quote-status-manager/validators.d.mts.map +1 -0
- package/dist/quote-status-manager/validators.mjs +39 -0
- package/dist/quote-status-manager/validators.mjs.map +1 -0
- package/dist/strategy/index.cjs +2 -0
- package/dist/strategy/index.cjs.map +1 -1
- package/dist/strategy/index.d.cts.map +1 -1
- package/dist/strategy/index.d.mts.map +1 -1
- package/dist/strategy/index.mjs +3 -1
- package/dist/strategy/index.mjs.map +1 -1
- package/dist/strategy/non-evm-strategy.cjs.map +1 -1
- package/dist/strategy/non-evm-strategy.d.cts +2 -2
- package/dist/strategy/non-evm-strategy.d.cts.map +1 -1
- package/dist/strategy/non-evm-strategy.d.mts +2 -2
- package/dist/strategy/non-evm-strategy.d.mts.map +1 -1
- package/dist/strategy/non-evm-strategy.mjs.map +1 -1
- package/dist/types.cjs +2 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +15 -3
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +15 -3
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +2 -0
- package/dist/types.mjs.map +1 -1
- package/dist/utils/history.cjs +1 -0
- package/dist/utils/history.cjs.map +1 -1
- package/dist/utils/history.d.cts.map +1 -1
- package/dist/utils/history.d.mts.map +1 -1
- package/dist/utils/history.mjs +1 -0
- package/dist/utils/history.mjs.map +1 -1
- package/dist/utils/snaps.cjs +20 -7
- package/dist/utils/snaps.cjs.map +1 -1
- package/dist/utils/snaps.d.cts +4 -2
- package/dist/utils/snaps.d.cts.map +1 -1
- package/dist/utils/snaps.d.mts +4 -2
- package/dist/utils/snaps.d.mts.map +1 -1
- package/dist/utils/snaps.mjs +20 -7
- package/dist/utils/snaps.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { QuoteStatusGetResponse, QuoteStatusUpdateResponse } from "./types.mjs";
|
|
2
|
+
export declare const QuoteStatusUpdateResponseSchema: import("@metamask/superstruct").Struct<{
|
|
3
|
+
type: import("./constants.mjs").QuoteStatusUpdateBackendErrorType.InvalidStatusTransaction | import("./constants.mjs").QuoteStatusUpdateBackendErrorType.QuoteStatusOnChainMismatch;
|
|
4
|
+
message: string;
|
|
5
|
+
statusCode: number;
|
|
6
|
+
currentStatus: import("./constants.mjs").QuoteStatusBackendStatus;
|
|
7
|
+
newStatus: import("./constants.mjs").QuoteStatusBackendStatus;
|
|
8
|
+
} | {
|
|
9
|
+
type: import("./constants.mjs").QuoteStatusUpdateBackendErrorType.QuoteNotFound | import("./constants.mjs").QuoteStatusUpdateBackendErrorType.ConcurrentUpdate | import("./constants.mjs").QuoteStatusUpdateBackendErrorType.SrcTxHashRequiredForFinalized | import("./constants.mjs").QuoteStatusUpdateBackendErrorType.PersistQuoteStatusFailed | import("./constants.mjs").QuoteStatusUpdateBackendErrorType.TransactionNotIndexed | import("./constants.mjs").QuoteStatusUpdateBackendErrorType.TxDataMissingHash | import("./constants.mjs").QuoteStatusUpdateBackendErrorType.TxDataMissingTrade | import("./constants.mjs").QuoteStatusUpdateBackendErrorType.TxDataMismatch | import("./constants.mjs").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.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.d.mts","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"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { string, number, enums, union, type, assert, optional } from "@metamask/superstruct";
|
|
2
|
+
import { StatusResponseSchema } from "../utils/validators.mjs";
|
|
3
|
+
import { BaseQuoteStatusUpdateErrorTypes, QuoteStatusUpdateBackendOnChainMismatchTypes, QuoteStatusBackendValues } from "./constants.mjs";
|
|
4
|
+
const QuoteStatusUpdateResponseWithCurrentStatusSchema = type({
|
|
5
|
+
statusCode: number(),
|
|
6
|
+
message: string(),
|
|
7
|
+
type: enums(QuoteStatusUpdateBackendOnChainMismatchTypes),
|
|
8
|
+
currentStatus: enums(QuoteStatusBackendValues),
|
|
9
|
+
newStatus: enums(QuoteStatusBackendValues),
|
|
10
|
+
});
|
|
11
|
+
const QuoteStatusUpdateResponseBaseSchema = type({
|
|
12
|
+
statusCode: number(),
|
|
13
|
+
message: string(),
|
|
14
|
+
type: enums(BaseQuoteStatusUpdateErrorTypes),
|
|
15
|
+
});
|
|
16
|
+
export const QuoteStatusUpdateResponseSchema = union([
|
|
17
|
+
QuoteStatusUpdateResponseWithCurrentStatusSchema,
|
|
18
|
+
QuoteStatusUpdateResponseBaseSchema,
|
|
19
|
+
]);
|
|
20
|
+
export function validateQuoteStatusUpdateResponse(data) {
|
|
21
|
+
assert(data, QuoteStatusUpdateResponseSchema);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* **Note**: This struct is big and not all fields are used atm.
|
|
25
|
+
* For that reason we have decided to only include the fields we
|
|
26
|
+
* consume in production. In the future, once we need it to be strongly type,
|
|
27
|
+
* we will refactor.
|
|
28
|
+
*/
|
|
29
|
+
export const QuoteStatusGetResponseSchema = type({
|
|
30
|
+
/**
|
|
31
|
+
* Submitted transaction: StatusResponseDto with at least srcChain (chainId + txHash).
|
|
32
|
+
* Prefilled by updateQuoteStatus; replaced with full provider status by getQuoteStatus.
|
|
33
|
+
*/
|
|
34
|
+
submittedTx: optional(StatusResponseSchema),
|
|
35
|
+
});
|
|
36
|
+
export function validateQuoteStatusGetResponse(data) {
|
|
37
|
+
assert(data, QuoteStatusGetResponseSchema);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=validators.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.mjs","sourceRoot":"","sources":["../../src/quote-status-manager/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,MAAM,EACN,KAAK,EACL,KAAK,EACL,IAAI,EACJ,MAAM,EACN,QAAQ,EACT,8BAA8B;AAE/B,OAAO,EAAE,oBAAoB,EAAE,gCAA4B;AAC3D,OAAO,EACL,+BAA+B,EAC/B,4CAA4C,EAC5C,wBAAwB,EACzB,wBAAoB;AAGrB,MAAM,gDAAgD,GAAG,IAAI,CAAC;IAC5D,UAAU,EAAE,MAAM,EAAE;IACpB,OAAO,EAAE,MAAM,EAAE;IACjB,IAAI,EAAE,KAAK,CAAC,4CAA4C,CAAC;IACzD,aAAa,EAAE,KAAK,CAAC,wBAAwB,CAAC;IAC9C,SAAS,EAAE,KAAK,CAAC,wBAAwB,CAAC;CAC3C,CAAC,CAAC;AAEH,MAAM,mCAAmC,GAAG,IAAI,CAAC;IAC/C,UAAU,EAAE,MAAM,EAAE;IACpB,OAAO,EAAE,MAAM,EAAE;IACjB,IAAI,EAAE,KAAK,CAAC,+BAA+B,CAAC;CAC7C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,+BAA+B,GAAG,KAAK,CAAC;IACnD,gDAAgD;IAChD,mCAAmC;CACpC,CAAC,CAAC;AAEH,MAAM,UAAU,iCAAiC,CAC/C,IAAa;IAEb,MAAM,CAAC,IAAI,EAAE,+BAA+B,CAAC,CAAC;AAChD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC;IAC/C;;;OAGG;IACH,WAAW,EAAE,QAAQ,CAAC,oBAAoB,CAAC;CAC5C,CAAC,CAAC;AAEH,MAAM,UAAU,8BAA8B,CAC5C,IAAa;IAEb,MAAM,CAAC,IAAI,EAAE,4BAA4B,CAAC,CAAC;AAC7C,CAAC","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"]}
|
package/dist/strategy/index.cjs
CHANGED
|
@@ -21,6 +21,8 @@ const validateParams = (params) => {
|
|
|
21
21
|
return txs.every((tx) => typeof tx === 'string');
|
|
22
22
|
case bridge_controller_1.ChainId.BTC:
|
|
23
23
|
return txs.every(bridge_controller_1.isBitcoinTrade);
|
|
24
|
+
case bridge_controller_1.ChainId.STELLAR:
|
|
25
|
+
return txs.every((tx) => typeof tx === 'string' || (0, bridge_controller_1.isStellarTrade)(tx));
|
|
24
26
|
case bridge_controller_1.ChainId.TRON:
|
|
25
27
|
return txs.every(bridge_controller_1.isTronTrade);
|
|
26
28
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/strategy/index.ts"],"names":[],"mappings":";;AAAA,iEAAiE;AACjE,
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/strategy/index.ts"],"names":[],"mappings":";;AAAA,iEAAiE;AACjE,mEAaqC;AAErC,mEAA+D;AAC/D,yDAAsD;AACtD,qDAA0E;AAC1E,2DAAwD;AACxD,6DAAyD;AAGzD,MAAM,cAAc,GAAG,CAQrB,MAAmC,EACS,EAAE;IAC9C,MAAM,GAAG,GAAG,MAAM,CAAC,cAAc;SAC9B,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC;QAC1B,aAAa,CAAC,KAAK;QACnB,aAAa,CAAC,QAAQ;QACtB,aAAa,CAAC,aAAa;KAC5B,CAAC;SACD,MAAM,CAAC,CAAC,EAAE,EAAoB,EAAE,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC;IAEtD,4CAA4C;IAC5C,QAAQ,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QAClD,KAAK,2BAAO,CAAC,MAAM;YACjB,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,KAAK,QAAQ,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,EAAE,CAAC;QAC/B,OAAO,IAAA,qCAAmB,EAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAED,0BAA0B;IAC1B,IAAI,uBAAuB,CAAC,MAAM,CAAC,EAAE,CAAC;QACpC,OAAO,IAAA,4CAAsB,EAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED,uBAAuB;IACvB,MAAM,cAAc,GAClB,YAAY,IAAI,aAAa,CAAC,KAAK,CAAC,eAAe,IAAI,kBAAkB,CAAC;IAC5E,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,IAAA,mCAAkB,EAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAED,mCAAmC;IACnC,OAAO,IAAA,+BAAoB,EAAC,MAAM,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF,kBAAe,qBAAqB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\nimport {\n BatchSellTradesResponse,\n BitcoinTradeData,\n ChainId,\n isBitcoinTrade,\n isEvmTxData,\n isNonEvmChainId,\n isStellarTrade,\n isTronTrade,\n StellarTradeData,\n Trade,\n TronTradeData,\n TxData,\n} from '@metamask/bridge-controller';\n\nimport { submitBatchSellHandler } from './batch-sell-strategy';\nimport { submitBatchHandler } from './batch-strategy';\nimport { submitEvmHandler as defaultSubmitHandler } from './evm-strategy';\nimport { submitIntentHandler } from './intent-strategy';\nimport { submitNonEvmHandler } from './non-evm-strategy';\nimport type { SubmitStrategyParams, SubmitStepResult } from './types';\n\nconst validateParams = <\n TxDataType extends\n | BitcoinTradeData\n | StellarTradeData\n | TronTradeData\n | string\n | TxData,\n>(\n params: SubmitStrategyParams<Trade>,\n): params is SubmitStrategyParams<TxDataType> => {\n const txs = params.quoteResponses\n .flatMap((quoteResponse) => [\n quoteResponse.trade,\n quoteResponse.approval,\n quoteResponse.resetApproval,\n ])\n .filter((tx): tx is TxDataType => tx !== undefined);\n\n // Assumes all quotes are for the same chain\n switch (params.quoteResponses[0].quote.srcChainId) {\n case ChainId.SOLANA:\n return txs.every((tx) => typeof tx === 'string');\n case ChainId.BTC:\n return txs.every(isBitcoinTrade);\n case ChainId.STELLAR:\n return txs.every((tx) => typeof tx === 'string' || isStellarTrade(tx));\n case ChainId.TRON:\n return txs.every(isTronTrade);\n default:\n return txs.every(isEvmTxData);\n }\n};\n\nconst validateBatchSellParams = (\n params: SubmitStrategyParams,\n): params is SubmitStrategyParams<TxData, BatchSellTradesResponse> =>\n // A BatchSell payload containing at least 1 trade is considered valid\n Boolean(params.batchSellTrades) && params.quoteResponses.length >= 1;\n\n/**\n * Selects the appropriate submit strategy based on the quote parameters then executes it\n *\n * @param params - The parameters for the transaction\n * @returns An async generator that yields results from each step of the submit flow. The yielded\n * results are used to update the BridgeStatusController state and emit events.\n */\nconst executeSubmitStrategy = (\n params: SubmitStrategyParams<Trade>,\n): AsyncGenerator<SubmitStepResult, void, void> => {\n const {\n quoteResponses: [quoteResponse],\n isStxEnabled,\n isDelegatedAccount,\n } = params;\n\n // Non-EVM transactions\n if (isNonEvmChainId(quoteResponse.quote.srcChainId)) {\n if (!validateParams(params)) {\n throw new Error(\n 'Failed to submit cross-chain swap transaction: trade is not a non-EVM transaction',\n );\n }\n return submitNonEvmHandler(params);\n }\n\n // EVM transactions\n if (!validateParams<TxData>(params)) {\n throw new Error(\n 'Failed to submit cross-chain swap transaction: trade is not an EVM transaction',\n );\n }\n\n // Intent transactions\n if (quoteResponse.quote.intent) {\n return submitIntentHandler(params);\n }\n\n // Batch sell transactions\n if (validateBatchSellParams(params)) {\n return submitBatchSellHandler(params);\n }\n\n // Batched transactions\n const shouldBatchTxs =\n isStxEnabled || quoteResponse.quote.gasIncluded7702 || isDelegatedAccount;\n if (shouldBatchTxs) {\n return submitBatchHandler(params);\n }\n\n // Non-stx/gasless EVM transactions\n return defaultSubmitHandler(params);\n};\n\nexport default executeSubmitStrategy;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/strategy/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/strategy/index.ts"],"names":[],"mappings":"AACA,OAAO,EAUL,KAAK,EAGN,oCAAoC;AAOrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,oBAAgB;AAyCtE;;;;;;GAMG;AACH,QAAA,MAAM,qBAAqB,WACjB,qBAAqB,KAAK,CAAC,KAClC,eAAe,gBAAgB,EAAE,IAAI,EAAE,IAAI,CA2C7C,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/strategy/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/strategy/index.ts"],"names":[],"mappings":"AACA,OAAO,EAUL,KAAK,EAGN,oCAAoC;AAOrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,oBAAgB;AAyCtE;;;;;;GAMG;AACH,QAAA,MAAM,qBAAqB,WACjB,qBAAqB,KAAK,CAAC,KAClC,eAAe,gBAAgB,EAAE,IAAI,EAAE,IAAI,CA2C7C,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
package/dist/strategy/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
|
2
|
-
import { ChainId, isBitcoinTrade, isEvmTxData, isNonEvmChainId, isTronTrade } from "@metamask/bridge-controller";
|
|
2
|
+
import { ChainId, isBitcoinTrade, isEvmTxData, isNonEvmChainId, isStellarTrade, isTronTrade } from "@metamask/bridge-controller";
|
|
3
3
|
import { submitBatchSellHandler } from "./batch-sell-strategy.mjs";
|
|
4
4
|
import { submitBatchHandler } from "./batch-strategy.mjs";
|
|
5
5
|
import { submitEvmHandler as defaultSubmitHandler } from "./evm-strategy.mjs";
|
|
@@ -19,6 +19,8 @@ const validateParams = (params) => {
|
|
|
19
19
|
return txs.every((tx) => typeof tx === 'string');
|
|
20
20
|
case ChainId.BTC:
|
|
21
21
|
return txs.every(isBitcoinTrade);
|
|
22
|
+
case ChainId.STELLAR:
|
|
23
|
+
return txs.every((tx) => typeof tx === 'string' || isStellarTrade(tx));
|
|
22
24
|
case ChainId.TRON:
|
|
23
25
|
return txs.every(isTronTrade);
|
|
24
26
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/strategy/index.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,OAAO,EAGL,OAAO,EACP,cAAc,EACd,WAAW,EACX,eAAe,EACf,WAAW,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/strategy/index.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,OAAO,EAGL,OAAO,EACP,cAAc,EACd,WAAW,EACX,eAAe,EACf,cAAc,EACd,WAAW,EAKZ,oCAAoC;AAErC,OAAO,EAAE,sBAAsB,EAAE,kCAA8B;AAC/D,OAAO,EAAE,kBAAkB,EAAE,6BAAyB;AACtD,OAAO,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,2BAAuB;AAC1E,OAAO,EAAE,mBAAmB,EAAE,8BAA0B;AACxD,OAAO,EAAE,mBAAmB,EAAE,+BAA2B;AAGzD,MAAM,cAAc,GAAG,CAQrB,MAAmC,EACS,EAAE;IAC9C,MAAM,GAAG,GAAG,MAAM,CAAC,cAAc;SAC9B,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC;QAC1B,aAAa,CAAC,KAAK;QACnB,aAAa,CAAC,QAAQ;QACtB,aAAa,CAAC,aAAa;KAC5B,CAAC;SACD,MAAM,CAAC,CAAC,EAAE,EAAoB,EAAE,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC;IAEtD,4CAA4C;IAC5C,QAAQ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ACnB,IAAI,CAAC,cAAc,CAAS,MAAM,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;IACJ,CAAC;IAED,sBAAsB;IACtB,IAAI,aAAa,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAC/B,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAED,0BAA0B;IAC1B,IAAI,uBAAuB,CAAC,MAAM,CAAC,EAAE,CAAC;QACpC,OAAO,sBAAsB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED,uBAAuB;IACvB,MAAM,cAAc,GAClB,YAAY,IAAI,aAAa,CAAC,KAAK,CAAC,eAAe,IAAI,kBAAkB,CAAC;IAC5E,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAED,mCAAmC;IACnC,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF,eAAe,qBAAqB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */\nimport {\n BatchSellTradesResponse,\n BitcoinTradeData,\n ChainId,\n isBitcoinTrade,\n isEvmTxData,\n isNonEvmChainId,\n isStellarTrade,\n isTronTrade,\n StellarTradeData,\n Trade,\n TronTradeData,\n TxData,\n} from '@metamask/bridge-controller';\n\nimport { submitBatchSellHandler } from './batch-sell-strategy';\nimport { submitBatchHandler } from './batch-strategy';\nimport { submitEvmHandler as defaultSubmitHandler } from './evm-strategy';\nimport { submitIntentHandler } from './intent-strategy';\nimport { submitNonEvmHandler } from './non-evm-strategy';\nimport type { SubmitStrategyParams, SubmitStepResult } from './types';\n\nconst validateParams = <\n TxDataType extends\n | BitcoinTradeData\n | StellarTradeData\n | TronTradeData\n | string\n | TxData,\n>(\n params: SubmitStrategyParams<Trade>,\n): params is SubmitStrategyParams<TxDataType> => {\n const txs = params.quoteResponses\n .flatMap((quoteResponse) => [\n quoteResponse.trade,\n quoteResponse.approval,\n quoteResponse.resetApproval,\n ])\n .filter((tx): tx is TxDataType => tx !== undefined);\n\n // Assumes all quotes are for the same chain\n switch (params.quoteResponses[0].quote.srcChainId) {\n case ChainId.SOLANA:\n return txs.every((tx) => typeof tx === 'string');\n case ChainId.BTC:\n return txs.every(isBitcoinTrade);\n case ChainId.STELLAR:\n return txs.every((tx) => typeof tx === 'string' || isStellarTrade(tx));\n case ChainId.TRON:\n return txs.every(isTronTrade);\n default:\n return txs.every(isEvmTxData);\n }\n};\n\nconst validateBatchSellParams = (\n params: SubmitStrategyParams,\n): params is SubmitStrategyParams<TxData, BatchSellTradesResponse> =>\n // A BatchSell payload containing at least 1 trade is considered valid\n Boolean(params.batchSellTrades) && params.quoteResponses.length >= 1;\n\n/**\n * Selects the appropriate submit strategy based on the quote parameters then executes it\n *\n * @param params - The parameters for the transaction\n * @returns An async generator that yields results from each step of the submit flow. The yielded\n * results are used to update the BridgeStatusController state and emit events.\n */\nconst executeSubmitStrategy = (\n params: SubmitStrategyParams<Trade>,\n): AsyncGenerator<SubmitStepResult, void, void> => {\n const {\n quoteResponses: [quoteResponse],\n isStxEnabled,\n isDelegatedAccount,\n } = params;\n\n // Non-EVM transactions\n if (isNonEvmChainId(quoteResponse.quote.srcChainId)) {\n if (!validateParams(params)) {\n throw new Error(\n 'Failed to submit cross-chain swap transaction: trade is not a non-EVM transaction',\n );\n }\n return submitNonEvmHandler(params);\n }\n\n // EVM transactions\n if (!validateParams<TxData>(params)) {\n throw new Error(\n 'Failed to submit cross-chain swap transaction: trade is not an EVM transaction',\n );\n }\n\n // Intent transactions\n if (quoteResponse.quote.intent) {\n return submitIntentHandler(params);\n }\n\n // Batch sell transactions\n if (validateBatchSellParams(params)) {\n return submitBatchSellHandler(params);\n }\n\n // Batched transactions\n const shouldBatchTxs =\n isStxEnabled || quoteResponse.quote.gasIncluded7702 || isDelegatedAccount;\n if (shouldBatchTxs) {\n return submitBatchHandler(params);\n }\n\n // Non-stx/gasless EVM transactions\n return defaultSubmitHandler(params);\n};\n\nexport default executeSubmitStrategy;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"non-evm-strategy.cjs","sourceRoot":"","sources":["../../src/strategy/non-evm-strategy.ts"],"names":[],"mappings":";;;AAAA,qEAAqE;AACrE,mEAA4D;
|
|
1
|
+
{"version":3,"file":"non-evm-strategy.cjs","sourceRoot":"","sources":["../../src/strategy/non-evm-strategy.ts"],"names":[],"mappings":";;;AAAA,qEAAqE;AACrE,mEAA4D;AAQ5D,8CAAgD;AAChD,8CAAwD;AACxD,0DAA2D;AAC3D,uCAAqC;AAGrC;;;;;GAKG;AACH,MAAM,kBAAkB,GAAG,KAAK,EAC9B,IAEC,EACD,EAAE;IACF,MAAM,EACJ,cAAc,EAAE,CAAC,aAAa,CAAC,EAC/B,OAAO,GACR,GAAG,IAAI,CAAC;IAET,MAAM,YAAY,GAAG,MAAM,OAAO,CAChC,IAAA,8BAAsB,EAAC,aAAa,EAAE,KAAK,CAAC,EAC5C,KAAK,IAAI,EAAE;QACT,IAAI,aAAa,CAAC,QAAQ,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,IAAA,sBAAc,EACjC,IAAI,CAAC,SAAS,EACd,aAAa,CAAC,QAAQ,EACtB,aAAa,EACb,IAAI,CAAC,eAAe,CACrB,CAAC;YACF,OAAO,MAAM,CAAC,EAAE,CAAC;QACnB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,CACF,CAAC;IAEF,IAAI,YAAY,EAAE,CAAC;QACjB,+CAA+C;QAC/C,MAAM,IAAA,iCAAmB,EAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC1D,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACI,KAAK,SAAS,CAAC,CAAC,mBAAmB,CACxC,IAEC;IAED,MAAM,EACJ,cAAc,EAAE,CAAC,aAAa,CAAC,EAC/B,UAAU,GACX,GAAG,IAAI,CAAC;IAET,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAEpD,oFAAoF;IAEpF,MAAM,SAAS,GAAG,MAAM,IAAA,sBAAc,EACpC,IAAI,CAAC,SAAS,EACd,aAAa,CAAC,KAAK,EACnB,aAAa,EACb,IAAI,CAAC,eAAe,CACrB,CAAC;IAEF,MAAM;QACJ,IAAI,EAAE,kBAAU,CAAC,YAAY;QAC7B,OAAO,EAAE,EAAE,SAAS,EAAE;KACvB,CAAC;IAEF,MAAM;QACJ,IAAI,EAAE,kBAAU,CAAC,cAAc;QAC/B,OAAO,EAAE;YACP,UAAU,EAAE,SAAS,CAAC,EAAE;YACxB,YAAY;YACZ,YAAY,EAAE;gBACZ,EAAE,EAAE,SAAS,CAAC,EAAE;gBAChB,IAAI,EAAE,SAAS,CAAC,IAAI;aACrB;YACD,aAAa;SACd;KACF,CAAC;IAEF,MAAM;QACJ,IAAI,EAAE,kBAAU,CAAC,YAAY;QAC7B,OAAO,EAAE;YACP,UAAU,EAAE,SAAS,CAAC,EAAE;SACzB;KACF,CAAC;IAEF,IAAI,CAAC,IAAA,iCAAa,EAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;QAClE,MAAM;YACJ,IAAI,EAAE,kBAAU,CAAC,qBAAqB;YACtC,OAAO,EAAE;gBACP,UAAU,EAAE,SAAS,CAAC,EAAE;aACzB;SACF,CAAC;IACJ,CAAC;AACH,CAAC;AAtDD,kDAsDC","sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport { isTronChainId } from '@metamask/bridge-controller';\nimport type {\n BitcoinTradeData,\n StellarTradeData,\n TronTradeData,\n TxData,\n} from '@metamask/bridge-controller';\n\nimport { handleNonEvmTx } from '../utils/snaps';\nimport { getApprovalTraceParams } from '../utils/trace';\nimport { handleApprovalDelay } from '../utils/transaction';\nimport { SubmitStep } from './types';\nimport type { SubmitStrategyParams, SubmitStepResult } from './types';\n\n/**\n * Submits the approval transaction for a non-EVM transaction if present\n *\n * @param args - The parameters for the transaction\n * @returns The tx id of the approval transaction\n */\nconst handleTronApproval = async (\n args: SubmitStrategyParams<\n TronTradeData | BitcoinTradeData | StellarTradeData | string | TxData\n >,\n) => {\n const {\n quoteResponses: [quoteResponse],\n traceFn,\n } = args;\n\n const approvalTxId = await traceFn(\n getApprovalTraceParams(quoteResponse, false),\n async () => {\n if (quoteResponse.approval) {\n const txMeta = await handleNonEvmTx(\n args.messenger,\n quoteResponse.approval,\n quoteResponse,\n args.selectedAccount,\n );\n return txMeta.id;\n }\n return undefined;\n },\n );\n\n if (approvalTxId) {\n // Add delay after approval similar to EVM flow\n await handleApprovalDelay(quoteResponse.quote.srcChainId);\n return approvalTxId;\n }\n return undefined;\n};\n\n/**\n * Submits Solana, Bitcoin, or Tron transactions to the snap controller\n *\n * @param args - The parameters for the transaction\n * @param args.quoteResponse - The quote response\n * @param args.messenger - The messenger\n * @param args.selectedAccount - The selected account\n * @param args.traceFn - The trace function\n * @param args.isBridgeTx - Whether the transaction is a bridge transaction\n * @yields The approvalTxId and tradeMeta for the non-EVM transaction\n */\nexport async function* submitNonEvmHandler(\n args: SubmitStrategyParams<\n BitcoinTradeData | StellarTradeData | TronTradeData | string | TxData\n >,\n): AsyncGenerator<SubmitStepResult, void, void> {\n const {\n quoteResponses: [quoteResponse],\n isBridgeTx,\n } = args;\n\n const approvalTxId = await handleTronApproval(args);\n\n // TODO bridge-status should update history with actionId if approvalTxId is present\n\n const tradeMeta = await handleNonEvmTx(\n args.messenger,\n quoteResponse.trade,\n quoteResponse,\n args.selectedAccount,\n );\n\n yield {\n type: SubmitStep.SetTradeMeta,\n payload: { tradeMeta },\n };\n\n yield {\n type: SubmitStep.AddHistoryItem,\n payload: {\n historyKey: tradeMeta.id,\n approvalTxId,\n bridgeTxMeta: {\n id: tradeMeta.id,\n hash: tradeMeta.hash,\n },\n quoteResponse,\n },\n };\n\n yield {\n type: SubmitStep.StartPolling,\n payload: {\n historyKey: tradeMeta.id,\n },\n };\n\n if (!isTronChainId(quoteResponse.quote.srcChainId) && !isBridgeTx) {\n yield {\n type: SubmitStep.PublishCompletedEvent,\n payload: {\n historyKey: tradeMeta.id,\n },\n };\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BitcoinTradeData, TronTradeData, TxData } from "@metamask/bridge-controller";
|
|
1
|
+
import type { BitcoinTradeData, StellarTradeData, TronTradeData, TxData } from "@metamask/bridge-controller";
|
|
2
2
|
import type { SubmitStrategyParams, SubmitStepResult } from "./types.cjs";
|
|
3
3
|
/**
|
|
4
4
|
* Submits Solana, Bitcoin, or Tron transactions to the snap controller
|
|
@@ -11,5 +11,5 @@ import type { SubmitStrategyParams, SubmitStepResult } from "./types.cjs";
|
|
|
11
11
|
* @param args.isBridgeTx - Whether the transaction is a bridge transaction
|
|
12
12
|
* @yields The approvalTxId and tradeMeta for the non-EVM transaction
|
|
13
13
|
*/
|
|
14
|
-
export declare function submitNonEvmHandler(args: SubmitStrategyParams<BitcoinTradeData | TronTradeData | string | TxData>): AsyncGenerator<SubmitStepResult, void, void>;
|
|
14
|
+
export declare function submitNonEvmHandler(args: SubmitStrategyParams<BitcoinTradeData | StellarTradeData | TronTradeData | string | TxData>): AsyncGenerator<SubmitStepResult, void, void>;
|
|
15
15
|
//# sourceMappingURL=non-evm-strategy.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"non-evm-strategy.d.cts","sourceRoot":"","sources":["../../src/strategy/non-evm-strategy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,MAAM,EACP,oCAAoC;AAMrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,oBAAgB;AA0CtE;;;;;;;;;;GAUG;AACH,wBAAuB,mBAAmB,CACxC,IAAI,EAAE,oBAAoB,CACxB,gBAAgB,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"non-evm-strategy.d.cts","sourceRoot":"","sources":["../../src/strategy/non-evm-strategy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,MAAM,EACP,oCAAoC;AAMrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,oBAAgB;AA0CtE;;;;;;;;;;GAUG;AACH,wBAAuB,mBAAmB,CACxC,IAAI,EAAE,oBAAoB,CACxB,gBAAgB,GAAG,gBAAgB,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,CACtE,GACA,cAAc,CAAC,gBAAgB,EAAE,IAAI,EAAE,IAAI,CAAC,CAkD9C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BitcoinTradeData, TronTradeData, TxData } from "@metamask/bridge-controller";
|
|
1
|
+
import type { BitcoinTradeData, StellarTradeData, TronTradeData, TxData } from "@metamask/bridge-controller";
|
|
2
2
|
import type { SubmitStrategyParams, SubmitStepResult } from "./types.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* Submits Solana, Bitcoin, or Tron transactions to the snap controller
|
|
@@ -11,5 +11,5 @@ import type { SubmitStrategyParams, SubmitStepResult } from "./types.mjs";
|
|
|
11
11
|
* @param args.isBridgeTx - Whether the transaction is a bridge transaction
|
|
12
12
|
* @yields The approvalTxId and tradeMeta for the non-EVM transaction
|
|
13
13
|
*/
|
|
14
|
-
export declare function submitNonEvmHandler(args: SubmitStrategyParams<BitcoinTradeData | TronTradeData | string | TxData>): AsyncGenerator<SubmitStepResult, void, void>;
|
|
14
|
+
export declare function submitNonEvmHandler(args: SubmitStrategyParams<BitcoinTradeData | StellarTradeData | TronTradeData | string | TxData>): AsyncGenerator<SubmitStepResult, void, void>;
|
|
15
15
|
//# sourceMappingURL=non-evm-strategy.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"non-evm-strategy.d.mts","sourceRoot":"","sources":["../../src/strategy/non-evm-strategy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,MAAM,EACP,oCAAoC;AAMrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,oBAAgB;AA0CtE;;;;;;;;;;GAUG;AACH,wBAAuB,mBAAmB,CACxC,IAAI,EAAE,oBAAoB,CACxB,gBAAgB,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"non-evm-strategy.d.mts","sourceRoot":"","sources":["../../src/strategy/non-evm-strategy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,MAAM,EACP,oCAAoC;AAMrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,oBAAgB;AA0CtE;;;;;;;;;;GAUG;AACH,wBAAuB,mBAAmB,CACxC,IAAI,EAAE,oBAAoB,CACxB,gBAAgB,GAAG,gBAAgB,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,CACtE,GACA,cAAc,CAAC,gBAAgB,EAAE,IAAI,EAAE,IAAI,CAAC,CAkD9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"non-evm-strategy.mjs","sourceRoot":"","sources":["../../src/strategy/non-evm-strategy.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,OAAO,EAAE,aAAa,EAAE,oCAAoC;
|
|
1
|
+
{"version":3,"file":"non-evm-strategy.mjs","sourceRoot":"","sources":["../../src/strategy/non-evm-strategy.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,OAAO,EAAE,aAAa,EAAE,oCAAoC;AAQ5D,OAAO,EAAE,cAAc,EAAE,2BAAuB;AAChD,OAAO,EAAE,sBAAsB,EAAE,2BAAuB;AACxD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,EAAE,EAAE,SAAS,EAAE;KACvB,CAAC;IAEF,MAAM;QACJ,IAAI,EAAE,UAAU,CAAC,cAAc;QAC/B,OAAO,EAAE;YACP,UAAU,EAAE,SAAS,CAAC,EAAE;YACxB,YAAY;YACZ,YAAY,EAAE;gBACZ,EAAE,EAAE,SAAS,CAAC,EAAE;gBAChB,IAAI,EAAE,SAAS,CAAC,IAAI;aACrB;YACD,aAAa;SACd;KACF,CAAC;IAEF,MAAM;QACJ,IAAI,EAAE,UAAU,CAAC,YAAY;QAC7B,OAAO,EAAE;YACP,UAAU,EAAE,SAAS,CAAC,EAAE;SACzB;KACF,CAAC;IAEF,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;QAClE,MAAM;YACJ,IAAI,EAAE,UAAU,CAAC,qBAAqB;YACtC,OAAO,EAAE;gBACP,UAAU,EAAE,SAAS,CAAC,EAAE;aACzB;SACF,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport { isTronChainId } from '@metamask/bridge-controller';\nimport type {\n BitcoinTradeData,\n StellarTradeData,\n TronTradeData,\n TxData,\n} from '@metamask/bridge-controller';\n\nimport { handleNonEvmTx } from '../utils/snaps';\nimport { getApprovalTraceParams } from '../utils/trace';\nimport { handleApprovalDelay } from '../utils/transaction';\nimport { SubmitStep } from './types';\nimport type { SubmitStrategyParams, SubmitStepResult } from './types';\n\n/**\n * Submits the approval transaction for a non-EVM transaction if present\n *\n * @param args - The parameters for the transaction\n * @returns The tx id of the approval transaction\n */\nconst handleTronApproval = async (\n args: SubmitStrategyParams<\n TronTradeData | BitcoinTradeData | StellarTradeData | string | TxData\n >,\n) => {\n const {\n quoteResponses: [quoteResponse],\n traceFn,\n } = args;\n\n const approvalTxId = await traceFn(\n getApprovalTraceParams(quoteResponse, false),\n async () => {\n if (quoteResponse.approval) {\n const txMeta = await handleNonEvmTx(\n args.messenger,\n quoteResponse.approval,\n quoteResponse,\n args.selectedAccount,\n );\n return txMeta.id;\n }\n return undefined;\n },\n );\n\n if (approvalTxId) {\n // Add delay after approval similar to EVM flow\n await handleApprovalDelay(quoteResponse.quote.srcChainId);\n return approvalTxId;\n }\n return undefined;\n};\n\n/**\n * Submits Solana, Bitcoin, or Tron transactions to the snap controller\n *\n * @param args - The parameters for the transaction\n * @param args.quoteResponse - The quote response\n * @param args.messenger - The messenger\n * @param args.selectedAccount - The selected account\n * @param args.traceFn - The trace function\n * @param args.isBridgeTx - Whether the transaction is a bridge transaction\n * @yields The approvalTxId and tradeMeta for the non-EVM transaction\n */\nexport async function* submitNonEvmHandler(\n args: SubmitStrategyParams<\n BitcoinTradeData | StellarTradeData | TronTradeData | string | TxData\n >,\n): AsyncGenerator<SubmitStepResult, void, void> {\n const {\n quoteResponses: [quoteResponse],\n isBridgeTx,\n } = args;\n\n const approvalTxId = await handleTronApproval(args);\n\n // TODO bridge-status should update history with actionId if approvalTxId is present\n\n const tradeMeta = await handleNonEvmTx(\n args.messenger,\n quoteResponse.trade,\n quoteResponse,\n args.selectedAccount,\n );\n\n yield {\n type: SubmitStep.SetTradeMeta,\n payload: { tradeMeta },\n };\n\n yield {\n type: SubmitStep.AddHistoryItem,\n payload: {\n historyKey: tradeMeta.id,\n approvalTxId,\n bridgeTxMeta: {\n id: tradeMeta.id,\n hash: tradeMeta.hash,\n },\n quoteResponse,\n },\n };\n\n yield {\n type: SubmitStep.StartPolling,\n payload: {\n historyKey: tradeMeta.id,\n },\n };\n\n if (!isTronChainId(quoteResponse.quote.srcChainId) && !isBridgeTx) {\n yield {\n type: SubmitStep.PublishCompletedEvent,\n payload: {\n historyKey: tradeMeta.id,\n },\n };\n }\n}\n"]}
|
package/dist/types.cjs
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BridgeStatusAction = exports.BridgeId = exports.BridgeClientId = void 0;
|
|
4
4
|
const constants_1 = require("./constants.cjs");
|
|
5
|
+
const constants_2 = require("./quote-status-manager/constants.cjs");
|
|
6
|
+
const validators_1 = require("./utils/validators.cjs");
|
|
5
7
|
// All fields need to be types not interfaces, same with their children fields
|
|
6
8
|
// o/w you get a type error
|
|
7
9
|
var BridgeClientId;
|
package/dist/types.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AA6CA,+CAA4D;AAG5D,8EAA8E;AAC9E,2BAA2B;AAE3B,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAyCD,IAAY,QAaX;AAbD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,2BAAe,CAAA;IACf,uCAA2B,CAAA;IAC3B,+BAAmB,CAAA;IACnB,+BAAmB,CAAA;IACnB,mCAAuB,CAAA;IACvB,qCAAyB,CAAA;IACzB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;IACrB,2BAAe,CAAA;IACf,2BAAe,CAAA;AACjB,CAAC,EAbW,QAAQ,wBAAR,QAAQ,QAanB;AA8GD;;;GAGG;AACH,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,qFAA+D,CAAA;IAC/D,2DAAqC,CAAA;IACrC,2CAAqB,CAAA;IACrB,+CAAyB,CAAA;IACzB,2CAAqB,CAAA;IACrB,mDAA6B,CAAA;IAC7B,yFAAmE,CAAA;IACnE,uFAAiE,CAAA;AACnE,CAAC,EATW,kBAAkB,kCAAlB,kBAAkB,QAS7B","sourcesContent":["import type { AccountsControllerGetAccountByAddressAction } from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n} from '@metamask/base-controller';\nimport type {\n ChainId,\n FeatureId,\n Quote,\n QuoteMetadata,\n QuoteResponse,\n MetaMetricsSwapsEventSource,\n SimulatedGasFeeLimits,\n TxData,\n TxFeeGasLimits,\n BridgeControllerTrackUnifiedSwapBridgeEventAction,\n BridgeControllerStopPollingForQuotesAction,\n BatchSellTradesResponse,\n BridgeControllerGetStateAction,\n InputPrimaryDenomination,\n} from '@metamask/bridge-controller';\nimport type { KeyringControllerSignTypedMessageAction } from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n NetworkControllerGetStateAction,\n} from '@metamask/network-controller';\nimport type { AuthenticationControllerGetBearerTokenAction } from '@metamask/profile-sync-controller/auth';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type { SnapControllerHandleRequestAction } from '@metamask/snaps-controllers';\nimport type { Infer } from '@metamask/superstruct';\nimport type {\n TransactionControllerAddTransactionAction,\n TransactionControllerEstimateGasFeeAction,\n TransactionControllerGetStateAction,\n TransactionControllerIsAtomicBatchSupportedAction,\n TransactionControllerTransactionStatusUpdatedEvent,\n TransactionControllerUpdateTransactionAction,\n TransactionMeta,\n TransactionType,\n} from '@metamask/transaction-controller';\nimport type { CaipAssetType } from '@metamask/utils';\n\nimport type { BridgeStatusControllerMethodActions } from './bridge-status-controller-method-action-types';\nimport { BRIDGE_STATUS_CONTROLLER_NAME } from './constants';\nimport type { StatusResponseSchema } from './utils/validators';\n\n// All fields need to be types not interfaces, same with their children fields\n// o/w you get a type error\n\nexport enum BridgeClientId {\n EXTENSION = 'extension',\n MOBILE = 'mobile',\n}\n\nexport type FetchFunction = (\n input: RequestInfo | URL,\n init?: RequestInit,\n) => Promise<unknown>;\n\n/**\n * These fields are specific to Solana transactions and can likely be infered from TransactionMeta\n *\n * @deprecated these should be removed eventually\n */\nexport type SolanaTransactionMeta = {\n isSolana: boolean;\n isBridgeTx: boolean;\n};\n\nexport type StatusRequest = {\n bridgeId: string; // lifi, socket, squid\n srcTxHash?: string; // lifi, socket, squid, might be undefined for STX\n bridge: string; // lifi, socket, squid\n srcChainId: ChainId; // lifi, socket, squid\n destChainId: ChainId; // lifi, socket, squid\n quote?: Quote; // squid\n refuel?: boolean; // lifi\n};\n\nexport type StatusRequestDto = Omit<\n StatusRequest,\n 'quote' | 'srcChainId' | 'destChainId' | 'refuel'\n> & {\n srcChainId: string; // lifi, socket, squid\n destChainId: string; // lifi, socket, squid\n requestId?: string;\n refuel?: string; // lifi\n};\n\nexport type StatusRequestWithSrcTxHash = StatusRequest & {\n srcTxHash: string;\n};\n\nexport enum BridgeId {\n HOP = 'hop',\n CELER = 'celer',\n CELERCIRCLE = 'celercircle',\n CONNEXT = 'connext',\n POLYGON = 'polygon',\n AVALANCHE = 'avalanche',\n MULTICHAIN = 'multichain',\n AXELAR = 'axelar',\n ACROSS = 'across',\n STARGATE = 'stargate',\n RELAY = 'relay',\n MAYAN = 'mayan',\n}\n\nexport type StatusResponse = Infer<typeof StatusResponseSchema>;\n\nexport type RefuelStatusResponse = object & StatusResponse;\n\n/**\n * This type ties together the quote, its tx params and the submitted txMeta.\n * Each trade/approval will have its own QuoteAndTxMetadata object.\n */\nexport type QuoteAndTxMetadata = {\n type: TransactionType;\n quoteResponse: QuoteResponse & QuoteMetadata;\n /**\n * The approval or trade object from the quote response\n */\n tx: TxData;\n assetsFiatValues?: { sending?: string; receiving?: string };\n /**\n * The simulated gas fee limits for the transaction provided by the bridge-api\n */\n txFee?: SimulatedGasFeeLimits | TxFeeGasLimits;\n /**\n * Transaction metadata from the TransactionController after submission\n */\n txMeta?: TransactionMeta;\n};\n\nexport type BridgeHistoryItem = {\n txMetaId?: string; // Optional: not available pre-submission or on sync failure\n actionId?: string; // Only for non-batch EVM transactions\n /**\n * @deprecated the txMeta or orderUid should be used instead\n */\n originalTransactionId?: string; // Keep original transaction ID for intent transactions\n batchId?: string;\n /**\n * This is defined when the history item is for a batch sell transaction\n */\n batchSellData?: BatchSellTradesResponse;\n /**\n * This is defined when the history item corresponds to the 7702 batch's delegation tx.\n * It contains the list of quoteIds for the BatchSell quotes that are part of the 7702 batch.\n * Each quote can be retrieved from txHistory as `txHistory[quoteId]`.\n */\n quoteIds?: string[];\n quote: Quote;\n status: StatusResponse;\n startTime: number; // timestamp in ms\n estimatedProcessingTimeInSeconds: number;\n slippagePercentage: number;\n completionTime?: number; // timestamp in ms\n pricingData?: {\n /**\n * The actual amount sent by user in non-atomic decimal form\n */\n amountSent: QuoteMetadata['sentAmount']['amount'];\n amountSentInUsd?: QuoteMetadata['sentAmount']['usd'];\n quotedGasInUsd?: QuoteMetadata['gasFee']['effective']['usd'];\n quotedGasAmount?: QuoteMetadata['gasFee']['effective']['amount'];\n quotedReturnInUsd?: QuoteMetadata['toTokenAmount']['usd'];\n quotedRefuelSrcAmountInUsd?: string;\n quotedRefuelDestAmountInUsd?: string;\n };\n initialDestAssetBalance?: string;\n targetContractAddress?: string;\n account: string;\n hasApprovalTx: boolean;\n approvalTxId?: string;\n featureId?: FeatureId;\n isStxEnabled?: boolean;\n /**\n * The location/entry point from which the user initiated the swap or bridge.\n * Used to attribute swaps to specific flows (e.g. Trending Explore).\n */\n location?: MetaMetricsSwapsEventSource;\n /**\n * Legacy A/B test metrics context (`ab_tests`) kept for backward compatibility.\n * Keys are test names, values are variant names (e.g. { token_details_layout: 'treatment' }).\n */\n abTests?: Record<string, string>;\n /**\n * New A/B test metrics context (`active_ab_tests`) that replaces `ab_tests`.\n * Kept separate so migration can run both payloads in parallel.\n * This field is an array of test objects.\n */\n activeAbTests?: { key: string; value: string }[];\n /**\n * Attempts tracking for exponential backoff on failed fetches.\n * We track the number of attempts and the last attempt time for each txMetaId that has failed at least once\n */\n attempts?: {\n counter: number;\n lastAttemptTime: number; // timestamp in ms\n };\n /**\n * Client-supplied security classification for the destination token at the\n * time the swap/bridge was submitted. Persisted so post-submit analytics\n * events (Completed, Failed, StatusValidationFailed) can include\n * `token_security_type_destination`. `null` when no security data was\n * available for the destination token.\n */\n tokenSecurityTypeDestination?: string | null;\n /**\n * The denomination shown as the primary source amount input when the\n * swap/bridge was submitted.\n */\n inputPrimaryDenomination?: InputPrimaryDenomination;\n};\n\n/**\n * @deprecated Use the separate action types instead (e.g.\n * `BridgeStatusControllerStartPollingForBridgeTxStatusAction`).\n */\nexport enum BridgeStatusAction {\n StartPollingForBridgeTxStatus = 'StartPollingForBridgeTxStatus',\n WipeBridgeStatus = 'WipeBridgeStatus',\n GetState = 'GetState',\n ResetState = 'ResetState',\n SubmitTx = 'SubmitTx',\n SubmitIntent = 'SubmitIntent',\n RestartPollingForFailedAttempts = 'RestartPollingForFailedAttempts',\n GetBridgeHistoryItemByTxMetaId = 'GetBridgeHistoryItemByTxMetaId',\n}\n\nexport type TokenAmountValuesSerialized = {\n amount: string;\n valueInCurrency: string | null;\n usd: string | null;\n};\n\nexport type QuoteMetadataSerialized = {\n gasFee: TokenAmountValuesSerialized;\n /**\n * The total network fee for the bridge transaction\n * estimatedGasFees + relayerFees\n */\n totalNetworkFee: TokenAmountValuesSerialized;\n /**\n * The total max network fee for the bridge transaction\n * maxGasFees + relayerFees\n */\n totalMaxNetworkFee: TokenAmountValuesSerialized;\n toTokenAmount: TokenAmountValuesSerialized;\n /**\n * The adjusted return for the bridge transaction\n * destTokenAmount - totalNetworkFee\n */\n adjustedReturn: Omit<TokenAmountValuesSerialized, 'amount'>;\n /**\n * The actual amount sent by user in non-atomic decimal form\n * srcTokenAmount + metabridgeFee\n */\n sentAmount: TokenAmountValuesSerialized;\n swapRate: string; // destTokenAmount / sentAmount\n /**\n * The cost of the bridge transaction\n * sentAmount - adjustedReturn\n */\n cost: Omit<TokenAmountValuesSerialized, 'amount'>;\n};\n\nexport type StartPollingForBridgeTxStatusArgs = {\n bridgeTxMeta?: Pick<TransactionMeta, 'id' | 'hash' | 'batchId'>;\n actionId?: string;\n batchSellData?: BridgeHistoryItem['batchSellData'];\n quoteIds?: BridgeHistoryItem['quoteIds'];\n /**\n * @deprecated the txMeta or orderUid should be used instead\n */\n originalTransactionId?: string;\n quoteResponse: QuoteResponse & QuoteMetadata;\n startTime: BridgeHistoryItem['startTime'];\n slippagePercentage: BridgeHistoryItem['slippagePercentage'];\n initialDestAssetBalance?: BridgeHistoryItem['initialDestAssetBalance'];\n targetContractAddress?: BridgeHistoryItem['targetContractAddress'];\n approvalTxId?: BridgeHistoryItem['approvalTxId'];\n isStxEnabled?: BridgeHistoryItem['isStxEnabled'];\n location: MetaMetricsSwapsEventSource;\n // Legacy field for `ab_tests` metrics payload.\n abTests?: BridgeHistoryItem['abTests'];\n // New field for `active_ab_tests` metrics payload.\n activeAbTests?: BridgeHistoryItem['activeAbTests'];\n accountAddress: string;\n // Client-supplied destination token security classification, persisted on\n // the history item for post-submit analytics events.\n tokenSecurityTypeDestination?: BridgeHistoryItem['tokenSecurityTypeDestination'];\n // Primary denomination at submission time, persisted for post-submit analytics.\n inputPrimaryDenomination?: BridgeHistoryItem['inputPrimaryDenomination'];\n};\n\n/**\n * Chrome: The BigNumber values are automatically serialized to strings when sent to the background\n * Firefox: The BigNumber values are not serialized to strings when sent to the background,\n * so we force the ui to do it manually, by using StartPollingForBridgeTxStatusArgsSerialized type on the startPollingForBridgeTxStatus action\n */\nexport type StartPollingForBridgeTxStatusArgsSerialized = Omit<\n StartPollingForBridgeTxStatusArgs,\n 'quoteResponse'\n> & {\n quoteResponse: QuoteResponse & QuoteMetadata;\n};\n\nexport type SourceChainTxMetaId = string;\n\nexport type BridgeStatusControllerState = {\n txHistory: Record<SourceChainTxMetaId, BridgeHistoryItem>;\n};\n\n// Actions\nexport type BridgeStatusControllerGetStateAction = ControllerGetStateAction<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\nexport type BridgeStatusControllerActions =\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerMethodActions;\n\n// Events\nexport type BridgeStatusControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n/**\n * This event is published when the destination bridge transaction is completed\n * The payload is the asset received on the destination chain\n */\nexport type BridgeStatusControllerDestinationTransactionCompletedEvent = {\n type: 'BridgeStatusController:destinationTransactionCompleted';\n payload: [CaipAssetType];\n};\n\nexport type BridgeStatusControllerEvents =\n | BridgeStatusControllerStateChangeEvent\n | BridgeStatusControllerDestinationTransactionCompletedEvent;\n\n/**\n * The external actions available to the BridgeStatusController.\n */\ntype AllowedActions =\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | RemoteFeatureFlagControllerGetStateAction\n | SnapControllerHandleRequestAction\n | TransactionControllerGetStateAction\n | TransactionControllerUpdateTransactionAction\n | TransactionControllerAddTransactionAction\n | TransactionControllerEstimateGasFeeAction\n | TransactionControllerIsAtomicBatchSupportedAction\n | BridgeControllerTrackUnifiedSwapBridgeEventAction\n | BridgeControllerStopPollingForQuotesAction\n | BridgeControllerGetStateAction\n | AccountsControllerGetAccountByAddressAction\n | AuthenticationControllerGetBearerTokenAction\n | KeyringControllerSignTypedMessageAction;\n\n/**\n * The external events available to the BridgeStatusController.\n */\ntype AllowedEvents = TransactionControllerTransactionStatusUpdatedEvent;\n\n/**\n * The messenger for the BridgeStatusController.\n */\nexport type BridgeStatusControllerMessenger = Messenger<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerActions | AllowedActions,\n BridgeStatusControllerEvents | AllowedEvents\n>;\n"]}
|
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AA8CA,+CAA4D;AAC5D,oEAAoE;AACpE,uDAA0D;AAE1D,8EAA8E;AAC9E,2BAA2B;AAE3B,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAyCD,IAAY,QAaX;AAbD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,2BAAe,CAAA;IACf,uCAA2B,CAAA;IAC3B,+BAAmB,CAAA;IACnB,+BAAmB,CAAA;IACnB,mCAAuB,CAAA;IACvB,qCAAyB,CAAA;IACzB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;IACrB,2BAAe,CAAA;IACf,2BAAe,CAAA;AACjB,CAAC,EAbW,QAAQ,wBAAR,QAAQ,QAanB;AAgHD;;;GAGG;AACH,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,qFAA+D,CAAA;IAC/D,2DAAqC,CAAA;IACrC,2CAAqB,CAAA;IACrB,+CAAyB,CAAA;IACzB,2CAAqB,CAAA;IACrB,mDAA6B,CAAA;IAC7B,yFAAmE,CAAA;IACnE,uFAAiE,CAAA;AACnE,CAAC,EATW,kBAAkB,kCAAlB,kBAAkB,QAS7B","sourcesContent":["import type { AccountsControllerGetAccountByAddressAction } from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n} from '@metamask/base-controller';\nimport type {\n ChainId,\n FeatureId,\n Quote,\n QuoteMetadata,\n QuoteResponse,\n MetaMetricsSwapsEventSource,\n SimulatedGasFeeLimits,\n TxData,\n TxFeeGasLimits,\n BridgeControllerTrackUnifiedSwapBridgeEventAction,\n BridgeControllerStopPollingForQuotesAction,\n BatchSellTradesResponse,\n BridgeControllerGetStateAction,\n InputPrimaryDenomination,\n} from '@metamask/bridge-controller';\nimport type { KeyringControllerSignTypedMessageAction } from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n NetworkControllerGetStateAction,\n} from '@metamask/network-controller';\nimport type { AuthenticationControllerGetBearerTokenAction } from '@metamask/profile-sync-controller/auth';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type { SnapControllerHandleRequestAction } from '@metamask/snaps-controllers';\nimport type { Infer } from '@metamask/superstruct';\nimport type {\n TransactionControllerAddTransactionAction,\n TransactionControllerEstimateGasFeeAction,\n TransactionControllerGetStateAction,\n TransactionControllerIsAtomicBatchSupportedAction,\n TransactionControllerTransactionStatusUpdatedEvent,\n TransactionControllerTransactionSubmittedEvent,\n TransactionControllerUpdateTransactionAction,\n TransactionMeta,\n TransactionType,\n} from '@metamask/transaction-controller';\nimport type { CaipAssetType } from '@metamask/utils';\n\nimport type { BridgeStatusControllerMethodActions } from './bridge-status-controller-method-action-types';\nimport { BRIDGE_STATUS_CONTROLLER_NAME } from './constants';\nimport { QuoteStatusState } from './quote-status-manager/constants';\nimport { StatusResponseSchema } from './utils/validators';\n\n// All fields need to be types not interfaces, same with their children fields\n// o/w you get a type error\n\nexport enum BridgeClientId {\n EXTENSION = 'extension',\n MOBILE = 'mobile',\n}\n\nexport type FetchFunction = (\n input: RequestInfo | URL,\n init?: RequestInit,\n) => Promise<unknown>;\n\n/**\n * These fields are specific to Solana transactions and can likely be infered from TransactionMeta\n *\n * @deprecated these should be removed eventually\n */\nexport type SolanaTransactionMeta = {\n isSolana: boolean;\n isBridgeTx: boolean;\n};\n\nexport type StatusRequest = {\n bridgeId: string; // lifi, socket, squid\n srcTxHash?: string; // lifi, socket, squid, might be undefined for STX\n bridge: string; // lifi, socket, squid\n srcChainId: ChainId; // lifi, socket, squid\n destChainId: ChainId; // lifi, socket, squid\n quote?: Quote; // squid\n refuel?: boolean; // lifi\n};\n\nexport type StatusRequestDto = Omit<\n StatusRequest,\n 'quote' | 'srcChainId' | 'destChainId' | 'refuel'\n> & {\n srcChainId: string; // lifi, socket, squid\n destChainId: string; // lifi, socket, squid\n requestId?: string;\n refuel?: string; // lifi\n};\n\nexport type StatusRequestWithSrcTxHash = StatusRequest & {\n srcTxHash: string;\n};\n\nexport enum BridgeId {\n HOP = 'hop',\n CELER = 'celer',\n CELERCIRCLE = 'celercircle',\n CONNEXT = 'connext',\n POLYGON = 'polygon',\n AVALANCHE = 'avalanche',\n MULTICHAIN = 'multichain',\n AXELAR = 'axelar',\n ACROSS = 'across',\n STARGATE = 'stargate',\n RELAY = 'relay',\n MAYAN = 'mayan',\n}\n\nexport type StatusResponse = Infer<typeof StatusResponseSchema>;\n\nexport type RefuelStatusResponse = object & StatusResponse;\n\n/**\n * This type ties together the quote, its tx params and the submitted txMeta.\n * Each trade/approval will have its own QuoteAndTxMetadata object.\n */\nexport type QuoteAndTxMetadata = {\n type: TransactionType;\n quoteResponse: QuoteResponse & QuoteMetadata;\n /**\n * The approval or trade object from the quote response\n */\n tx: TxData;\n assetsFiatValues?: { sending?: string; receiving?: string };\n /**\n * The simulated gas fee limits for the transaction provided by the bridge-api\n */\n txFee?: SimulatedGasFeeLimits | TxFeeGasLimits;\n /**\n * Transaction metadata from the TransactionController after submission\n */\n txMeta?: TransactionMeta;\n};\n\nexport type BridgeHistoryItem = {\n txMetaId?: string; // Optional: not available pre-submission or on sync failure\n actionId?: string; // Only for non-batch EVM transactions\n /**\n * @deprecated the txMeta or orderUid should be used instead\n */\n originalTransactionId?: string; // Keep original transaction ID for intent transactions\n batchId?: string;\n /**\n * This is defined when the history item is for a batch sell transaction\n */\n batchSellData?: BatchSellTradesResponse;\n /**\n * This is defined when the history item corresponds to the 7702 batch's delegation tx.\n * It contains the list of quoteIds for the BatchSell quotes that are part of the 7702 batch.\n * Each quote can be retrieved from txHistory as `txHistory[quoteId]`.\n */\n quoteIds?: string[];\n quote: Quote;\n quoteId?: string; // Optional: absent on history items persisted before this field was introduced\n reportedSubmittedTxHash?: string;\n status: StatusResponse;\n startTime: number; // timestamp in ms\n estimatedProcessingTimeInSeconds: number;\n slippagePercentage: number;\n completionTime?: number; // timestamp in ms\n pricingData?: {\n /**\n * The actual amount sent by user in non-atomic decimal form\n */\n amountSent: QuoteMetadata['sentAmount']['amount'];\n amountSentInUsd?: QuoteMetadata['sentAmount']['usd'];\n quotedGasInUsd?: QuoteMetadata['gasFee']['effective']['usd'];\n quotedGasAmount?: QuoteMetadata['gasFee']['effective']['amount'];\n quotedReturnInUsd?: QuoteMetadata['toTokenAmount']['usd'];\n quotedRefuelSrcAmountInUsd?: string;\n quotedRefuelDestAmountInUsd?: string;\n };\n initialDestAssetBalance?: string;\n targetContractAddress?: string;\n account: string;\n hasApprovalTx: boolean;\n approvalTxId?: string;\n featureId?: FeatureId;\n isStxEnabled?: boolean;\n /**\n * The location/entry point from which the user initiated the swap or bridge.\n * Used to attribute swaps to specific flows (e.g. Trending Explore).\n */\n location?: MetaMetricsSwapsEventSource;\n /**\n * Legacy A/B test metrics context (`ab_tests`) kept for backward compatibility.\n * Keys are test names, values are variant names (e.g. { token_details_layout: 'treatment' }).\n */\n abTests?: Record<string, string>;\n /**\n * New A/B test metrics context (`active_ab_tests`) that replaces `ab_tests`.\n * Kept separate so migration can run both payloads in parallel.\n * This field is an array of test objects.\n */\n activeAbTests?: { key: string; value: string }[];\n /**\n * Attempts tracking for exponential backoff on failed fetches.\n * We track the number of attempts and the last attempt time for each txMetaId that has failed at least once\n */\n attempts?: {\n counter: number;\n lastAttemptTime: number; // timestamp in ms\n };\n /**\n * Client-supplied security classification for the destination token at the\n * time the swap/bridge was submitted. Persisted so post-submit analytics\n * events (Completed, Failed, StatusValidationFailed) can include\n * `token_security_type_destination`. `null` when no security data was\n * available for the destination token.\n */\n tokenSecurityTypeDestination?: string | null;\n /**\n * The denomination shown as the primary source amount input when the\n * swap/bridge was submitted.\n */\n inputPrimaryDenomination?: InputPrimaryDenomination;\n};\n\n/**\n * @deprecated Use the separate action types instead (e.g.\n * `BridgeStatusControllerStartPollingForBridgeTxStatusAction`).\n */\nexport enum BridgeStatusAction {\n StartPollingForBridgeTxStatus = 'StartPollingForBridgeTxStatus',\n WipeBridgeStatus = 'WipeBridgeStatus',\n GetState = 'GetState',\n ResetState = 'ResetState',\n SubmitTx = 'SubmitTx',\n SubmitIntent = 'SubmitIntent',\n RestartPollingForFailedAttempts = 'RestartPollingForFailedAttempts',\n GetBridgeHistoryItemByTxMetaId = 'GetBridgeHistoryItemByTxMetaId',\n}\n\nexport type TokenAmountValuesSerialized = {\n amount: string;\n valueInCurrency: string | null;\n usd: string | null;\n};\n\nexport type QuoteMetadataSerialized = {\n gasFee: TokenAmountValuesSerialized;\n /**\n * The total network fee for the bridge transaction\n * estimatedGasFees + relayerFees\n */\n totalNetworkFee: TokenAmountValuesSerialized;\n /**\n * The total max network fee for the bridge transaction\n * maxGasFees + relayerFees\n */\n totalMaxNetworkFee: TokenAmountValuesSerialized;\n toTokenAmount: TokenAmountValuesSerialized;\n /**\n * The adjusted return for the bridge transaction\n * destTokenAmount - totalNetworkFee\n */\n adjustedReturn: Omit<TokenAmountValuesSerialized, 'amount'>;\n /**\n * The actual amount sent by user in non-atomic decimal form\n * srcTokenAmount + metabridgeFee\n */\n sentAmount: TokenAmountValuesSerialized;\n swapRate: string; // destTokenAmount / sentAmount\n /**\n * The cost of the bridge transaction\n * sentAmount - adjustedReturn\n */\n cost: Omit<TokenAmountValuesSerialized, 'amount'>;\n};\n\nexport type StartPollingForBridgeTxStatusArgs = {\n bridgeTxMeta?: Pick<TransactionMeta, 'id' | 'hash' | 'batchId'>;\n actionId?: string;\n batchSellData?: BridgeHistoryItem['batchSellData'];\n quoteIds?: BridgeHistoryItem['quoteIds'];\n /**\n * @deprecated the txMeta or orderUid should be used instead\n */\n originalTransactionId?: string;\n quoteResponse: QuoteResponse & QuoteMetadata;\n startTime: BridgeHistoryItem['startTime'];\n slippagePercentage: BridgeHistoryItem['slippagePercentage'];\n initialDestAssetBalance?: BridgeHistoryItem['initialDestAssetBalance'];\n targetContractAddress?: BridgeHistoryItem['targetContractAddress'];\n approvalTxId?: BridgeHistoryItem['approvalTxId'];\n isStxEnabled?: BridgeHistoryItem['isStxEnabled'];\n location: MetaMetricsSwapsEventSource;\n // Legacy field for `ab_tests` metrics payload.\n abTests?: BridgeHistoryItem['abTests'];\n // New field for `active_ab_tests` metrics payload.\n activeAbTests?: BridgeHistoryItem['activeAbTests'];\n accountAddress: string;\n // Client-supplied destination token security classification, persisted on\n // the history item for post-submit analytics events.\n tokenSecurityTypeDestination?: BridgeHistoryItem['tokenSecurityTypeDestination'];\n // Primary denomination at submission time, persisted for post-submit analytics.\n inputPrimaryDenomination?: BridgeHistoryItem['inputPrimaryDenomination'];\n};\n\n/**\n * Chrome: The BigNumber values are automatically serialized to strings when sent to the background\n * Firefox: The BigNumber values are not serialized to strings when sent to the background,\n * so we force the ui to do it manually, by using StartPollingForBridgeTxStatusArgsSerialized type on the startPollingForBridgeTxStatus action\n */\nexport type StartPollingForBridgeTxStatusArgsSerialized = Omit<\n StartPollingForBridgeTxStatusArgs,\n 'quoteResponse'\n> & {\n quoteResponse: QuoteResponse & QuoteMetadata;\n};\n\nexport type SourceChainTxMetaId = string;\n\nexport type QuoteStatusPersistEntry = {\n quoteId: string;\n srcTxHash: string;\n status: QuoteStatusState;\n createdAt: number;\n lastAttemptAt: number;\n txMetaId?: string;\n};\n\nexport type BridgeStatusControllerState = {\n txHistory: Record<SourceChainTxMetaId, BridgeHistoryItem>;\n quoteUpdateStatusStore: Record<string, QuoteStatusPersistEntry>;\n};\n\n// Actions\nexport type BridgeStatusControllerGetStateAction = ControllerGetStateAction<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\nexport type BridgeStatusControllerActions =\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerMethodActions;\n\n// Events\nexport type BridgeStatusControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n/**\n * This event is published when the destination bridge transaction is completed\n * The payload is the asset received on the destination chain\n */\nexport type BridgeStatusControllerDestinationTransactionCompletedEvent = {\n type: 'BridgeStatusController:destinationTransactionCompleted';\n payload: [CaipAssetType];\n};\n\nexport type BridgeStatusControllerEvents =\n | BridgeStatusControllerStateChangeEvent\n | BridgeStatusControllerDestinationTransactionCompletedEvent;\n\n/**\n * The external actions available to the BridgeStatusController.\n */\ntype AllowedActions =\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | RemoteFeatureFlagControllerGetStateAction\n | SnapControllerHandleRequestAction\n | TransactionControllerGetStateAction\n | TransactionControllerUpdateTransactionAction\n | TransactionControllerAddTransactionAction\n | TransactionControllerEstimateGasFeeAction\n | TransactionControllerIsAtomicBatchSupportedAction\n | BridgeControllerTrackUnifiedSwapBridgeEventAction\n | BridgeControllerStopPollingForQuotesAction\n | BridgeControllerGetStateAction\n | AccountsControllerGetAccountByAddressAction\n | AuthenticationControllerGetBearerTokenAction\n | KeyringControllerSignTypedMessageAction;\n\n/**\n * The external events available to the BridgeStatusController.\n */\ntype AllowedEvents =\n | TransactionControllerTransactionStatusUpdatedEvent\n | TransactionControllerTransactionSubmittedEvent;\n\n/**\n * The messenger for the BridgeStatusController.\n */\nexport type BridgeStatusControllerMessenger = Messenger<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerActions | AllowedActions,\n BridgeStatusControllerEvents | AllowedEvents\n>;\n"]}
|
package/dist/types.d.cts
CHANGED
|
@@ -8,11 +8,12 @@ import type { AuthenticationControllerGetBearerTokenAction } from "@metamask/pro
|
|
|
8
8
|
import type { RemoteFeatureFlagControllerGetStateAction } from "@metamask/remote-feature-flag-controller";
|
|
9
9
|
import type { SnapControllerHandleRequestAction } from "@metamask/snaps-controllers";
|
|
10
10
|
import type { Infer } from "@metamask/superstruct";
|
|
11
|
-
import type { TransactionControllerAddTransactionAction, TransactionControllerEstimateGasFeeAction, TransactionControllerGetStateAction, TransactionControllerIsAtomicBatchSupportedAction, TransactionControllerTransactionStatusUpdatedEvent, TransactionControllerUpdateTransactionAction, TransactionMeta, TransactionType } from "@metamask/transaction-controller";
|
|
11
|
+
import type { TransactionControllerAddTransactionAction, TransactionControllerEstimateGasFeeAction, TransactionControllerGetStateAction, TransactionControllerIsAtomicBatchSupportedAction, TransactionControllerTransactionStatusUpdatedEvent, TransactionControllerTransactionSubmittedEvent, TransactionControllerUpdateTransactionAction, TransactionMeta, TransactionType } from "@metamask/transaction-controller";
|
|
12
12
|
import type { CaipAssetType } from "@metamask/utils";
|
|
13
13
|
import type { BridgeStatusControllerMethodActions } from "./bridge-status-controller-method-action-types.cjs";
|
|
14
14
|
import { BRIDGE_STATUS_CONTROLLER_NAME } from "./constants.cjs";
|
|
15
|
-
import
|
|
15
|
+
import { QuoteStatusState } from "./quote-status-manager/constants.cjs";
|
|
16
|
+
import { StatusResponseSchema } from "./utils/validators.cjs";
|
|
16
17
|
export declare enum BridgeClientId {
|
|
17
18
|
EXTENSION = "extension",
|
|
18
19
|
MOBILE = "mobile"
|
|
@@ -104,6 +105,8 @@ export type BridgeHistoryItem = {
|
|
|
104
105
|
*/
|
|
105
106
|
quoteIds?: string[];
|
|
106
107
|
quote: Quote;
|
|
108
|
+
quoteId?: string;
|
|
109
|
+
reportedSubmittedTxHash?: string;
|
|
107
110
|
status: StatusResponse;
|
|
108
111
|
startTime: number;
|
|
109
112
|
estimatedProcessingTimeInSeconds: number;
|
|
@@ -250,8 +253,17 @@ export type StartPollingForBridgeTxStatusArgsSerialized = Omit<StartPollingForBr
|
|
|
250
253
|
quoteResponse: QuoteResponse & QuoteMetadata;
|
|
251
254
|
};
|
|
252
255
|
export type SourceChainTxMetaId = string;
|
|
256
|
+
export type QuoteStatusPersistEntry = {
|
|
257
|
+
quoteId: string;
|
|
258
|
+
srcTxHash: string;
|
|
259
|
+
status: QuoteStatusState;
|
|
260
|
+
createdAt: number;
|
|
261
|
+
lastAttemptAt: number;
|
|
262
|
+
txMetaId?: string;
|
|
263
|
+
};
|
|
253
264
|
export type BridgeStatusControllerState = {
|
|
254
265
|
txHistory: Record<SourceChainTxMetaId, BridgeHistoryItem>;
|
|
266
|
+
quoteUpdateStatusStore: Record<string, QuoteStatusPersistEntry>;
|
|
255
267
|
};
|
|
256
268
|
export type BridgeStatusControllerGetStateAction = ControllerGetStateAction<typeof BRIDGE_STATUS_CONTROLLER_NAME, BridgeStatusControllerState>;
|
|
257
269
|
export type BridgeStatusControllerActions = BridgeStatusControllerGetStateAction | BridgeStatusControllerMethodActions;
|
|
@@ -272,7 +284,7 @@ type AllowedActions = NetworkControllerFindNetworkClientIdByChainIdAction | Netw
|
|
|
272
284
|
/**
|
|
273
285
|
* The external events available to the BridgeStatusController.
|
|
274
286
|
*/
|
|
275
|
-
type AllowedEvents = TransactionControllerTransactionStatusUpdatedEvent;
|
|
287
|
+
type AllowedEvents = TransactionControllerTransactionStatusUpdatedEvent | TransactionControllerTransactionSubmittedEvent;
|
|
276
288
|
/**
|
|
277
289
|
* The messenger for the BridgeStatusController.
|
|
278
290
|
*/
|
package/dist/types.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2CAA2C,EAAE,sCAAsC;AACjG,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC3B,kCAAkC;AACnC,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EACT,KAAK,EACL,aAAa,EACb,aAAa,EACb,2BAA2B,EAC3B,qBAAqB,EACrB,MAAM,EACN,cAAc,EACd,iDAAiD,EACjD,0CAA0C,EAC1C,uBAAuB,EACvB,8BAA8B,EAC9B,wBAAwB,EACzB,oCAAoC;AACrC,OAAO,KAAK,EAAE,uCAAuC,EAAE,qCAAqC;AAC5F,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AACrD,OAAO,KAAK,EACV,mDAAmD,EACnD,2CAA2C,EAC3C,+BAA+B,EAChC,qCAAqC;AACtC,OAAO,KAAK,EAAE,4CAA4C,EAAE,+CAA+C;AAC3G,OAAO,KAAK,EAAE,yCAAyC,EAAE,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