@metamask-previews/bridge-status-controller 32.0.0-preview-3c8bcc82 → 33.0.0-preview-f9a5dd05
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 +23 -1
- package/dist/index.cjs +1 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types.cjs +1 -12
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +9 -74
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +9 -74
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +0 -11
- package/dist/types.mjs.map +1 -1
- package/dist/utils/metrics.cjs +2 -2
- package/dist/utils/metrics.cjs.map +1 -1
- package/dist/utils/metrics.mjs +2 -2
- package/dist/utils/metrics.mjs.map +1 -1
- package/dist/utils/transaction.d.cts +149 -6
- package/dist/utils/transaction.d.cts.map +1 -1
- package/dist/utils/transaction.d.mts +149 -6
- package/dist/utils/transaction.d.mts.map +1 -1
- package/dist/utils/validators.cjs +36 -34
- package/dist/utils/validators.cjs.map +1 -1
- package/dist/utils/validators.d.cts +117 -0
- package/dist/utils/validators.d.cts.map +1 -1
- package/dist/utils/validators.d.mts +117 -0
- package/dist/utils/validators.d.mts.map +1 -1
- package/dist/utils/validators.mjs +36 -34
- package/dist/utils/validators.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [33.0.0]
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
|
14
|
+
- Consolidate validator and type definitions for `StatusResponse` so new response fields only need to be defined once ([#6030](https://github.com/MetaMask/core/pull/6030))
|
15
|
+
|
16
|
+
### Removed
|
17
|
+
|
18
|
+
- Clean up unused exports that duplicate @metamask/bridge-controller's ([#6030](https://github.com/MetaMask/core/pull/6030))
|
19
|
+
- Asset
|
20
|
+
- SrcChainStatus
|
21
|
+
- DestChainStatus
|
22
|
+
- RefuelData
|
23
|
+
- FeeType
|
24
|
+
- ActionTypes
|
25
|
+
|
26
|
+
### Fixed
|
27
|
+
|
28
|
+
- Set event property `gas_included` to quote's `gasIncluded` value ([#6030](https://github.com/MetaMask/core/pull/6030))
|
29
|
+
- Set StatusResponse ChainId schema to expect a number instead of a string ([#6045](https://github.com/MetaMask/core/pull/6045))
|
30
|
+
|
10
31
|
## [32.0.0]
|
11
32
|
|
12
33
|
### Changed
|
@@ -356,7 +377,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
356
377
|
|
357
378
|
- Initial release ([#5317](https://github.com/MetaMask/core/pull/5317))
|
358
379
|
|
359
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@
|
380
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@33.0.0...HEAD
|
381
|
+
[33.0.0]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@32.0.0...@metamask/bridge-status-controller@33.0.0
|
360
382
|
[32.0.0]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@31.0.0...@metamask/bridge-status-controller@32.0.0
|
361
383
|
[31.0.0]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@30.0.0...@metamask/bridge-status-controller@31.0.0
|
362
384
|
[30.0.0]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@29.1.1...@metamask/bridge-status-controller@30.0.0
|
package/dist/index.cjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getTxMetaFields = exports.BridgeStatusController = exports.BridgeStatusAction = exports.
|
3
|
+
exports.getTxMetaFields = exports.BridgeStatusController = exports.BridgeStatusAction = exports.BridgeId = exports.BRIDGE_STATUS_CONTROLLER_NAME = exports.DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE = exports.REFRESH_INTERVAL_MS = void 0;
|
4
4
|
// Export constants
|
5
5
|
var constants_1 = require("./constants.cjs");
|
6
6
|
Object.defineProperty(exports, "REFRESH_INTERVAL_MS", { enumerable: true, get: function () { return constants_1.REFRESH_INTERVAL_MS; } });
|
@@ -8,8 +8,6 @@ Object.defineProperty(exports, "DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE", { enume
|
|
8
8
|
Object.defineProperty(exports, "BRIDGE_STATUS_CONTROLLER_NAME", { enumerable: true, get: function () { return constants_1.BRIDGE_STATUS_CONTROLLER_NAME; } });
|
9
9
|
var types_1 = require("./types.cjs");
|
10
10
|
Object.defineProperty(exports, "BridgeId", { enumerable: true, get: function () { return types_1.BridgeId; } });
|
11
|
-
Object.defineProperty(exports, "FeeType", { enumerable: true, get: function () { return types_1.FeeType; } });
|
12
|
-
Object.defineProperty(exports, "ActionTypes", { enumerable: true, get: function () { return types_1.ActionTypes; } });
|
13
11
|
Object.defineProperty(exports, "BridgeStatusAction", { enumerable: true, get: function () { return types_1.BridgeStatusAction; } });
|
14
12
|
var bridge_status_controller_1 = require("./bridge-status-controller.cjs");
|
15
13
|
Object.defineProperty(exports, "BridgeStatusController", { enumerable: true, get: function () { return bridge_status_controller_1.BridgeStatusController; } });
|
package/dist/index.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mBAAmB;AACnB,6CAIqB;AAHnB,gHAAA,mBAAmB,OAAA;AACnB,mIAAA,sCAAsC,OAAA;AACtC,0HAAA,6BAA6B,OAAA;
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mBAAmB;AACnB,6CAIqB;AAHnB,gHAAA,mBAAmB,OAAA;AACnB,mIAAA,sCAAsC,OAAA;AACtC,0HAAA,6BAA6B,OAAA;AA0B/B,qCAAuD;AAA9C,iGAAA,QAAQ,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAErC,2EAAoE;AAA3D,kIAAA,sBAAsB,OAAA;AAE/B,uDAAsD;AAA7C,8GAAA,eAAe,OAAA","sourcesContent":["// Export constants\nexport {\n REFRESH_INTERVAL_MS,\n DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE,\n BRIDGE_STATUS_CONTROLLER_NAME,\n} from './constants';\n\nexport type {\n FetchFunction,\n StatusRequest,\n StatusRequestDto,\n StatusRequestWithSrcTxHash,\n StatusResponse,\n RefuelStatusResponse,\n BridgeHistoryItem,\n BridgeStatusControllerState,\n BridgeStatusControllerMessenger,\n BridgeStatusControllerActions,\n BridgeStatusControllerGetStateAction,\n BridgeStatusControllerStartPollingForBridgeTxStatusAction,\n BridgeStatusControllerWipeBridgeStatusAction,\n BridgeStatusControllerResetStateAction,\n BridgeStatusControllerEvents,\n BridgeStatusControllerStateChangeEvent,\n StartPollingForBridgeTxStatusArgs,\n StartPollingForBridgeTxStatusArgsSerialized,\n TokenAmountValuesSerialized,\n QuoteMetadataSerialized,\n} from './types';\n\nexport { BridgeId, BridgeStatusAction } from './types';\n\nexport { BridgeStatusController } from './bridge-status-controller';\n\nexport { getTxMetaFields } from './utils/transaction';\n"]}
|
package/dist/index.d.cts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export { REFRESH_INTERVAL_MS, DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE, BRIDGE_STATUS_CONTROLLER_NAME, } from "./constants.cjs";
|
2
|
-
export type { FetchFunction, StatusRequest, StatusRequestDto, StatusRequestWithSrcTxHash,
|
3
|
-
export { BridgeId,
|
2
|
+
export type { FetchFunction, StatusRequest, StatusRequestDto, StatusRequestWithSrcTxHash, StatusResponse, RefuelStatusResponse, BridgeHistoryItem, BridgeStatusControllerState, BridgeStatusControllerMessenger, BridgeStatusControllerActions, BridgeStatusControllerGetStateAction, BridgeStatusControllerStartPollingForBridgeTxStatusAction, BridgeStatusControllerWipeBridgeStatusAction, BridgeStatusControllerResetStateAction, BridgeStatusControllerEvents, BridgeStatusControllerStateChangeEvent, StartPollingForBridgeTxStatusArgs, StartPollingForBridgeTxStatusArgsSerialized, TokenAmountValuesSerialized, QuoteMetadataSerialized, } from "./types.cjs";
|
3
|
+
export { BridgeId, BridgeStatusAction } from "./types.cjs";
|
4
4
|
export { BridgeStatusController } from "./bridge-status-controller.cjs";
|
5
5
|
export { getTxMetaFields } from "./utils/transaction.cjs";
|
6
6
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,sCAAsC,EACtC,6BAA6B,GAC9B,wBAAoB;AAErB,YAAY,EACV,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,0BAA0B,EAC1B,
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,sCAAsC,EACtC,6BAA6B,GAC9B,wBAAoB;AAErB,YAAY,EACV,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,0BAA0B,EAC1B,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,2BAA2B,EAC3B,+BAA+B,EAC/B,6BAA6B,EAC7B,oCAAoC,EACpC,yDAAyD,EACzD,4CAA4C,EAC5C,sCAAsC,EACtC,4BAA4B,EAC5B,sCAAsC,EACtC,iCAAiC,EACjC,2CAA2C,EAC3C,2BAA2B,EAC3B,uBAAuB,GACxB,oBAAgB;AAEjB,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,oBAAgB;AAEvD,OAAO,EAAE,sBAAsB,EAAE,uCAAmC;AAEpE,OAAO,EAAE,eAAe,EAAE,gCAA4B"}
|
package/dist/index.d.mts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export { REFRESH_INTERVAL_MS, DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE, BRIDGE_STATUS_CONTROLLER_NAME, } from "./constants.mjs";
|
2
|
-
export type { FetchFunction, StatusRequest, StatusRequestDto, StatusRequestWithSrcTxHash,
|
3
|
-
export { BridgeId,
|
2
|
+
export type { FetchFunction, StatusRequest, StatusRequestDto, StatusRequestWithSrcTxHash, StatusResponse, RefuelStatusResponse, BridgeHistoryItem, BridgeStatusControllerState, BridgeStatusControllerMessenger, BridgeStatusControllerActions, BridgeStatusControllerGetStateAction, BridgeStatusControllerStartPollingForBridgeTxStatusAction, BridgeStatusControllerWipeBridgeStatusAction, BridgeStatusControllerResetStateAction, BridgeStatusControllerEvents, BridgeStatusControllerStateChangeEvent, StartPollingForBridgeTxStatusArgs, StartPollingForBridgeTxStatusArgsSerialized, TokenAmountValuesSerialized, QuoteMetadataSerialized, } from "./types.mjs";
|
3
|
+
export { BridgeId, BridgeStatusAction } from "./types.mjs";
|
4
4
|
export { BridgeStatusController } from "./bridge-status-controller.mjs";
|
5
5
|
export { getTxMetaFields } from "./utils/transaction.mjs";
|
6
6
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,sCAAsC,EACtC,6BAA6B,GAC9B,wBAAoB;AAErB,YAAY,EACV,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,0BAA0B,EAC1B,
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,sCAAsC,EACtC,6BAA6B,GAC9B,wBAAoB;AAErB,YAAY,EACV,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,0BAA0B,EAC1B,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,2BAA2B,EAC3B,+BAA+B,EAC/B,6BAA6B,EAC7B,oCAAoC,EACpC,yDAAyD,EACzD,4CAA4C,EAC5C,sCAAsC,EACtC,4BAA4B,EAC5B,sCAAsC,EACtC,iCAAiC,EACjC,2CAA2C,EAC3C,2BAA2B,EAC3B,uBAAuB,GACxB,oBAAgB;AAEjB,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,oBAAgB;AAEvD,OAAO,EAAE,sBAAsB,EAAE,uCAAmC;AAEpE,OAAO,EAAE,eAAe,EAAE,gCAA4B"}
|
package/dist/index.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
// Export constants
|
2
2
|
export { REFRESH_INTERVAL_MS, DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE, BRIDGE_STATUS_CONTROLLER_NAME } from "./constants.mjs";
|
3
|
-
export { BridgeId,
|
3
|
+
export { BridgeId, BridgeStatusAction } from "./types.mjs";
|
4
4
|
export { BridgeStatusController } from "./bridge-status-controller.mjs";
|
5
5
|
export { getTxMetaFields } from "./utils/transaction.mjs";
|
6
6
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,EACL,mBAAmB,EACnB,sCAAsC,EACtC,6BAA6B,EAC9B,wBAAoB;
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,EACL,mBAAmB,EACnB,sCAAsC,EACtC,6BAA6B,EAC9B,wBAAoB;AAyBrB,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,oBAAgB;AAEvD,OAAO,EAAE,sBAAsB,EAAE,uCAAmC;AAEpE,OAAO,EAAE,eAAe,EAAE,gCAA4B","sourcesContent":["// Export constants\nexport {\n REFRESH_INTERVAL_MS,\n DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE,\n BRIDGE_STATUS_CONTROLLER_NAME,\n} from './constants';\n\nexport type {\n FetchFunction,\n StatusRequest,\n StatusRequestDto,\n StatusRequestWithSrcTxHash,\n StatusResponse,\n RefuelStatusResponse,\n BridgeHistoryItem,\n BridgeStatusControllerState,\n BridgeStatusControllerMessenger,\n BridgeStatusControllerActions,\n BridgeStatusControllerGetStateAction,\n BridgeStatusControllerStartPollingForBridgeTxStatusAction,\n BridgeStatusControllerWipeBridgeStatusAction,\n BridgeStatusControllerResetStateAction,\n BridgeStatusControllerEvents,\n BridgeStatusControllerStateChangeEvent,\n StartPollingForBridgeTxStatusArgs,\n StartPollingForBridgeTxStatusArgsSerialized,\n TokenAmountValuesSerialized,\n QuoteMetadataSerialized,\n} from './types';\n\nexport { BridgeId, BridgeStatusAction } from './types';\n\nexport { BridgeStatusController } from './bridge-status-controller';\n\nexport { getTxMetaFields } from './utils/transaction';\n"]}
|
package/dist/types.cjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.BridgeStatusAction = exports.
|
3
|
+
exports.BridgeStatusAction = exports.BridgeId = exports.BridgeClientId = void 0;
|
4
4
|
// All fields need to be types not interfaces, same with their children fields
|
5
5
|
// o/w you get a type error
|
6
6
|
var BridgeClientId;
|
@@ -23,17 +23,6 @@ var BridgeId;
|
|
23
23
|
BridgeId["RELAY"] = "relay";
|
24
24
|
BridgeId["MAYAN"] = "mayan";
|
25
25
|
})(BridgeId || (exports.BridgeId = BridgeId = {}));
|
26
|
-
var FeeType;
|
27
|
-
(function (FeeType) {
|
28
|
-
FeeType["METABRIDGE"] = "metabridge";
|
29
|
-
FeeType["REFUEL"] = "refuel";
|
30
|
-
})(FeeType || (exports.FeeType = FeeType = {}));
|
31
|
-
var ActionTypes;
|
32
|
-
(function (ActionTypes) {
|
33
|
-
ActionTypes["BRIDGE"] = "bridge";
|
34
|
-
ActionTypes["SWAP"] = "swap";
|
35
|
-
ActionTypes["REFUEL"] = "refuel";
|
36
|
-
})(ActionTypes || (exports.ActionTypes = ActionTypes = {}));
|
37
26
|
var BridgeStatusAction;
|
38
27
|
(function (BridgeStatusAction) {
|
39
28
|
BridgeStatusAction["START_POLLING_FOR_BRIDGE_TX_STATUS"] = "startPollingForBridgeTxStatus";
|
package/dist/types.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAqCA,8EAA8E;AAC9E,2BAA2B;AAE3B,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AA2ED,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;AAED,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,oCAAyB,CAAA;IACzB,4BAAiB,CAAA;AACnB,CAAC,EAHW,OAAO,uBAAP,OAAO,QAGlB;AAaD,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,gCAAiB,CAAA;AACnB,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AAsDD,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,0FAAoE,CAAA;IACpE,6DAAuC,CAAA;IACvC,4CAAsB,CAAA;IACtB,gDAA0B,CAAA;IAC1B,4CAAsB,CAAA;AACxB,CAAC,EANW,kBAAkB,kCAAlB,kBAAkB,QAM7B","sourcesContent":["import type {\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerGetSelectedMultichainAccountAction,\n} from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n RestrictedMessenger,\n} from '@metamask/base-controller';\nimport type {\n BridgeBackgroundAction,\n BridgeControllerAction,\n ChainId,\n Quote,\n QuoteMetadata,\n QuoteResponse,\n StatusTypes,\n TxData,\n} from '@metamask/bridge-controller';\nimport type { GetGasFeeState } from '@metamask/gas-fee-controller';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n NetworkControllerGetStateAction,\n} from '@metamask/network-controller';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type { HandleSnapRequest } from '@metamask/snaps-controllers';\nimport type {\n TransactionControllerGetStateAction,\n TransactionControllerTransactionConfirmedEvent,\n TransactionControllerTransactionFailedEvent,\n TransactionMeta,\n} from '@metamask/transaction-controller';\n\nimport type { BridgeStatusController } from './bridge-status-controller';\nimport type { BRIDGE_STATUS_CONTROLLER_NAME } from './constants';\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n) => Promise<any>;\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 type Asset = {\n chainId: ChainId;\n address: string;\n symbol: string;\n name: string;\n decimals: number;\n icon?: string | null;\n};\n\nexport type SrcChainStatus = {\n chainId: ChainId;\n /**\n * The txHash of the transaction on the source chain.\n * This might be undefined for smart transactions (STX)\n */\n txHash?: string;\n /**\n * The atomic amount of the token sent minus fees on the source chain\n */\n amount?: string;\n token?: Record<string, never> | Asset;\n};\n\nexport type DestChainStatus = {\n chainId: ChainId;\n txHash?: string;\n /**\n * The atomic amount of the token received on the destination chain\n */\n amount?: string;\n token?: Record<string, never> | Asset;\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 enum FeeType {\n METABRIDGE = 'metabridge',\n REFUEL = 'refuel',\n}\n\nexport type FeeData = {\n amount: string;\n asset: Asset;\n};\n\nexport type Protocol = {\n displayName?: string;\n icon?: string;\n name?: string; // for legacy quotes\n};\n\nexport enum ActionTypes {\n BRIDGE = 'bridge',\n SWAP = 'swap',\n REFUEL = 'refuel',\n}\n\nexport type Step = {\n action: ActionTypes;\n srcChainId: ChainId;\n destChainId?: ChainId;\n srcAsset: Asset;\n destAsset: Asset;\n srcAmount: string;\n destAmount: string;\n protocol: Protocol;\n};\n\nexport type StatusResponse = {\n status: StatusTypes;\n srcChain: SrcChainStatus;\n destChain?: DestChainStatus;\n bridge?: BridgeId;\n isExpectedToken?: boolean;\n isUnrecognizedRouterAddress?: boolean;\n refuel?: RefuelStatusResponse;\n};\n\nexport type RefuelStatusResponse = object & StatusResponse;\n\nexport type RefuelData = object & Step;\n\nexport type BridgeHistoryItem = {\n txMetaId: string; // Need this to handle STX that might not have a txHash immediately\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 * From QuoteMetadata.sentAmount.amount, the actual amount sent by user in non-atomic decimal form\n */\n amountSent: string;\n amountSentInUsd?: string;\n quotedGasInUsd?: string; // from QuoteMetadata.gasFee.usd\n quotedReturnInUsd?: string; // from 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 isStxEnabled?: boolean;\n};\n\nexport enum BridgeStatusAction {\n START_POLLING_FOR_BRIDGE_TX_STATUS = 'startPollingForBridgeTxStatus',\n WIPE_BRIDGE_STATUS = 'wipeBridgeStatus',\n GET_STATE = 'getState',\n RESET_STATE = 'resetState',\n SUBMIT_TX = 'submitTx',\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: TransactionMeta;\n statusRequest: StatusRequest;\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};\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<string | TxData> & QuoteMetadata;\n};\n\nexport type SourceChainTxMetaId = string;\n\nexport type BridgeStatusControllerState = {\n txHistory: Record<SourceChainTxMetaId, BridgeHistoryItem>;\n};\n\n// Actions\ntype BridgeStatusControllerAction<\n FunctionName extends keyof BridgeStatusController,\n> = {\n type: `${typeof BRIDGE_STATUS_CONTROLLER_NAME}:${FunctionName}`;\n handler: BridgeStatusController[FunctionName];\n};\n\nexport type BridgeStatusControllerGetStateAction = ControllerGetStateAction<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\n// Maps to BridgeController function names\nexport type BridgeStatusControllerStartPollingForBridgeTxStatusAction =\n BridgeStatusControllerAction<BridgeStatusAction.START_POLLING_FOR_BRIDGE_TX_STATUS>;\n\nexport type BridgeStatusControllerWipeBridgeStatusAction =\n BridgeStatusControllerAction<BridgeStatusAction.WIPE_BRIDGE_STATUS>;\n\nexport type BridgeStatusControllerResetStateAction =\n BridgeStatusControllerAction<BridgeStatusAction.RESET_STATE>;\n\nexport type BridgeStatusControllerSubmitTxAction =\n BridgeStatusControllerAction<BridgeStatusAction.SUBMIT_TX>;\n\nexport type BridgeStatusControllerActions =\n | BridgeStatusControllerStartPollingForBridgeTxStatusAction\n | BridgeStatusControllerWipeBridgeStatusAction\n | BridgeStatusControllerResetStateAction\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerSubmitTxAction;\n\n// Events\nexport type BridgeStatusControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\nexport type BridgeStatusControllerEvents =\n BridgeStatusControllerStateChangeEvent;\n\n/**\n * The external actions available to the BridgeStatusController.\n */\ntype AllowedActions =\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | AccountsControllerGetSelectedMultichainAccountAction\n | HandleSnapRequest\n | TransactionControllerGetStateAction\n | BridgeControllerAction<BridgeBackgroundAction.GET_BRIDGE_ERC20_ALLOWANCE>\n | BridgeControllerAction<BridgeBackgroundAction.TRACK_METAMETRICS_EVENT>\n | BridgeControllerAction<BridgeBackgroundAction.STOP_POLLING_FOR_QUOTES>\n | GetGasFeeState\n | AccountsControllerGetAccountByAddressAction\n | RemoteFeatureFlagControllerGetStateAction;\n\n/**\n * The external events available to the BridgeStatusController.\n */\ntype AllowedEvents =\n | TransactionControllerTransactionFailedEvent\n | TransactionControllerTransactionConfirmedEvent;\n\n/**\n * The messenger for the BridgeStatusController.\n */\nexport type BridgeStatusControllerMessenger = RestrictedMessenger<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerActions | AllowedActions,\n BridgeStatusControllerEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n"]}
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAsCA,8EAA8E;AAC9E,2BAA2B;AAE3B,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AA0CD,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;AAiCD,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,0FAAoE,CAAA;IACpE,6DAAuC,CAAA;IACvC,4CAAsB,CAAA;IACtB,gDAA0B,CAAA;IAC1B,4CAAsB,CAAA;AACxB,CAAC,EANW,kBAAkB,kCAAlB,kBAAkB,QAM7B","sourcesContent":["import type {\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerGetSelectedMultichainAccountAction,\n} from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n RestrictedMessenger,\n} from '@metamask/base-controller';\nimport type {\n BridgeBackgroundAction,\n BridgeControllerAction,\n ChainId,\n Quote,\n QuoteMetadata,\n QuoteResponse,\n TxData,\n} from '@metamask/bridge-controller';\nimport type { GetGasFeeState } from '@metamask/gas-fee-controller';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n NetworkControllerGetStateAction,\n} from '@metamask/network-controller';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type { HandleSnapRequest } from '@metamask/snaps-controllers';\nimport type { Infer } from '@metamask/superstruct';\nimport type {\n TransactionControllerGetStateAction,\n TransactionControllerTransactionConfirmedEvent,\n TransactionControllerTransactionFailedEvent,\n TransactionMeta,\n} from '@metamask/transaction-controller';\n\nimport type { BridgeStatusController } from './bridge-status-controller';\nimport type { 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n) => Promise<any>;\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\nexport type BridgeHistoryItem = {\n txMetaId: string; // Need this to handle STX that might not have a txHash immediately\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']['usd'];\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 isStxEnabled?: boolean;\n};\n\nexport enum BridgeStatusAction {\n START_POLLING_FOR_BRIDGE_TX_STATUS = 'startPollingForBridgeTxStatus',\n WIPE_BRIDGE_STATUS = 'wipeBridgeStatus',\n GET_STATE = 'getState',\n RESET_STATE = 'resetState',\n SUBMIT_TX = 'submitTx',\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: TransactionMeta;\n statusRequest: StatusRequest;\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};\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<string | TxData> & QuoteMetadata;\n};\n\nexport type SourceChainTxMetaId = string;\n\nexport type BridgeStatusControllerState = {\n txHistory: Record<SourceChainTxMetaId, BridgeHistoryItem>;\n};\n\n// Actions\ntype BridgeStatusControllerAction<\n FunctionName extends keyof BridgeStatusController,\n> = {\n type: `${typeof BRIDGE_STATUS_CONTROLLER_NAME}:${FunctionName}`;\n handler: BridgeStatusController[FunctionName];\n};\n\nexport type BridgeStatusControllerGetStateAction = ControllerGetStateAction<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\n// Maps to BridgeController function names\nexport type BridgeStatusControllerStartPollingForBridgeTxStatusAction =\n BridgeStatusControllerAction<BridgeStatusAction.START_POLLING_FOR_BRIDGE_TX_STATUS>;\n\nexport type BridgeStatusControllerWipeBridgeStatusAction =\n BridgeStatusControllerAction<BridgeStatusAction.WIPE_BRIDGE_STATUS>;\n\nexport type BridgeStatusControllerResetStateAction =\n BridgeStatusControllerAction<BridgeStatusAction.RESET_STATE>;\n\nexport type BridgeStatusControllerSubmitTxAction =\n BridgeStatusControllerAction<BridgeStatusAction.SUBMIT_TX>;\n\nexport type BridgeStatusControllerActions =\n | BridgeStatusControllerStartPollingForBridgeTxStatusAction\n | BridgeStatusControllerWipeBridgeStatusAction\n | BridgeStatusControllerResetStateAction\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerSubmitTxAction;\n\n// Events\nexport type BridgeStatusControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\nexport type BridgeStatusControllerEvents =\n BridgeStatusControllerStateChangeEvent;\n\n/**\n * The external actions available to the BridgeStatusController.\n */\ntype AllowedActions =\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | AccountsControllerGetSelectedMultichainAccountAction\n | HandleSnapRequest\n | TransactionControllerGetStateAction\n | BridgeControllerAction<BridgeBackgroundAction.GET_BRIDGE_ERC20_ALLOWANCE>\n | BridgeControllerAction<BridgeBackgroundAction.TRACK_METAMETRICS_EVENT>\n | BridgeControllerAction<BridgeBackgroundAction.STOP_POLLING_FOR_QUOTES>\n | GetGasFeeState\n | AccountsControllerGetAccountByAddressAction\n | RemoteFeatureFlagControllerGetStateAction;\n\n/**\n * The external events available to the BridgeStatusController.\n */\ntype AllowedEvents =\n | TransactionControllerTransactionFailedEvent\n | TransactionControllerTransactionConfirmedEvent;\n\n/**\n * The messenger for the BridgeStatusController.\n */\nexport type BridgeStatusControllerMessenger = RestrictedMessenger<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerActions | AllowedActions,\n BridgeStatusControllerEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n"]}
|
package/dist/types.d.cts
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
import type { AccountsControllerGetAccountByAddressAction, AccountsControllerGetSelectedMultichainAccountAction } from "@metamask/accounts-controller";
|
2
2
|
import type { ControllerGetStateAction, ControllerStateChangeEvent, RestrictedMessenger } from "@metamask/base-controller";
|
3
|
-
import type { BridgeBackgroundAction, BridgeControllerAction, ChainId, Quote, QuoteMetadata, QuoteResponse,
|
3
|
+
import type { BridgeBackgroundAction, BridgeControllerAction, ChainId, Quote, QuoteMetadata, QuoteResponse, TxData } from "@metamask/bridge-controller";
|
4
4
|
import type { GetGasFeeState } from "@metamask/gas-fee-controller";
|
5
5
|
import type { NetworkControllerFindNetworkClientIdByChainIdAction, NetworkControllerGetNetworkClientByIdAction, NetworkControllerGetStateAction } from "@metamask/network-controller";
|
6
6
|
import type { RemoteFeatureFlagControllerGetStateAction } from "@metamask/remote-feature-flag-controller";
|
7
7
|
import type { HandleSnapRequest } from "@metamask/snaps-controllers";
|
8
|
+
import type { Infer } from "@metamask/superstruct";
|
8
9
|
import type { TransactionControllerGetStateAction, TransactionControllerTransactionConfirmedEvent, TransactionControllerTransactionFailedEvent, TransactionMeta } from "@metamask/transaction-controller";
|
9
10
|
import type { BridgeStatusController } from "./bridge-status-controller.cjs";
|
10
11
|
import type { BRIDGE_STATUS_CONTROLLER_NAME } from "./constants.cjs";
|
12
|
+
import type { StatusResponseSchema } from "./utils/validators.cjs";
|
11
13
|
export declare enum BridgeClientId {
|
12
14
|
EXTENSION = "extension",
|
13
15
|
MOBILE = "mobile"
|
@@ -40,36 +42,6 @@ export type StatusRequestDto = Omit<StatusRequest, 'quote' | 'srcChainId' | 'des
|
|
40
42
|
export type StatusRequestWithSrcTxHash = StatusRequest & {
|
41
43
|
srcTxHash: string;
|
42
44
|
};
|
43
|
-
export type Asset = {
|
44
|
-
chainId: ChainId;
|
45
|
-
address: string;
|
46
|
-
symbol: string;
|
47
|
-
name: string;
|
48
|
-
decimals: number;
|
49
|
-
icon?: string | null;
|
50
|
-
};
|
51
|
-
export type SrcChainStatus = {
|
52
|
-
chainId: ChainId;
|
53
|
-
/**
|
54
|
-
* The txHash of the transaction on the source chain.
|
55
|
-
* This might be undefined for smart transactions (STX)
|
56
|
-
*/
|
57
|
-
txHash?: string;
|
58
|
-
/**
|
59
|
-
* The atomic amount of the token sent minus fees on the source chain
|
60
|
-
*/
|
61
|
-
amount?: string;
|
62
|
-
token?: Record<string, never> | Asset;
|
63
|
-
};
|
64
|
-
export type DestChainStatus = {
|
65
|
-
chainId: ChainId;
|
66
|
-
txHash?: string;
|
67
|
-
/**
|
68
|
-
* The atomic amount of the token received on the destination chain
|
69
|
-
*/
|
70
|
-
amount?: string;
|
71
|
-
token?: Record<string, never> | Asset;
|
72
|
-
};
|
73
45
|
export declare enum BridgeId {
|
74
46
|
HOP = "hop",
|
75
47
|
CELER = "celer",
|
@@ -84,45 +56,8 @@ export declare enum BridgeId {
|
|
84
56
|
RELAY = "relay",
|
85
57
|
MAYAN = "mayan"
|
86
58
|
}
|
87
|
-
export
|
88
|
-
METABRIDGE = "metabridge",
|
89
|
-
REFUEL = "refuel"
|
90
|
-
}
|
91
|
-
export type FeeData = {
|
92
|
-
amount: string;
|
93
|
-
asset: Asset;
|
94
|
-
};
|
95
|
-
export type Protocol = {
|
96
|
-
displayName?: string;
|
97
|
-
icon?: string;
|
98
|
-
name?: string;
|
99
|
-
};
|
100
|
-
export declare enum ActionTypes {
|
101
|
-
BRIDGE = "bridge",
|
102
|
-
SWAP = "swap",
|
103
|
-
REFUEL = "refuel"
|
104
|
-
}
|
105
|
-
export type Step = {
|
106
|
-
action: ActionTypes;
|
107
|
-
srcChainId: ChainId;
|
108
|
-
destChainId?: ChainId;
|
109
|
-
srcAsset: Asset;
|
110
|
-
destAsset: Asset;
|
111
|
-
srcAmount: string;
|
112
|
-
destAmount: string;
|
113
|
-
protocol: Protocol;
|
114
|
-
};
|
115
|
-
export type StatusResponse = {
|
116
|
-
status: StatusTypes;
|
117
|
-
srcChain: SrcChainStatus;
|
118
|
-
destChain?: DestChainStatus;
|
119
|
-
bridge?: BridgeId;
|
120
|
-
isExpectedToken?: boolean;
|
121
|
-
isUnrecognizedRouterAddress?: boolean;
|
122
|
-
refuel?: RefuelStatusResponse;
|
123
|
-
};
|
59
|
+
export type StatusResponse = Infer<typeof StatusResponseSchema>;
|
124
60
|
export type RefuelStatusResponse = object & StatusResponse;
|
125
|
-
export type RefuelData = object & Step;
|
126
61
|
export type BridgeHistoryItem = {
|
127
62
|
txMetaId: string;
|
128
63
|
quote: Quote;
|
@@ -133,12 +68,12 @@ export type BridgeHistoryItem = {
|
|
133
68
|
completionTime?: number;
|
134
69
|
pricingData?: {
|
135
70
|
/**
|
136
|
-
*
|
71
|
+
* The actual amount sent by user in non-atomic decimal form
|
137
72
|
*/
|
138
|
-
amountSent:
|
139
|
-
amountSentInUsd?:
|
140
|
-
quotedGasInUsd?:
|
141
|
-
quotedReturnInUsd?:
|
73
|
+
amountSent: QuoteMetadata['sentAmount']['amount'];
|
74
|
+
amountSentInUsd?: QuoteMetadata['sentAmount']['usd'];
|
75
|
+
quotedGasInUsd?: QuoteMetadata['gasFee']['usd'];
|
76
|
+
quotedReturnInUsd?: QuoteMetadata['toTokenAmount']['usd'];
|
142
77
|
quotedRefuelSrcAmountInUsd?: string;
|
143
78
|
quotedRefuelDestAmountInUsd?: string;
|
144
79
|
};
|
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,EACV,2CAA2C,EAC3C,oDAAoD,EACrD,sCAAsC;AACvC,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,E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 +1,15 @@
|
|
1
1
|
import type { AccountsControllerGetAccountByAddressAction, AccountsControllerGetSelectedMultichainAccountAction } from "@metamask/accounts-controller";
|
2
2
|
import type { ControllerGetStateAction, ControllerStateChangeEvent, RestrictedMessenger } from "@metamask/base-controller";
|
3
|
-
import type { BridgeBackgroundAction, BridgeControllerAction, ChainId, Quote, QuoteMetadata, QuoteResponse,
|
3
|
+
import type { BridgeBackgroundAction, BridgeControllerAction, ChainId, Quote, QuoteMetadata, QuoteResponse, TxData } from "@metamask/bridge-controller";
|
4
4
|
import type { GetGasFeeState } from "@metamask/gas-fee-controller";
|
5
5
|
import type { NetworkControllerFindNetworkClientIdByChainIdAction, NetworkControllerGetNetworkClientByIdAction, NetworkControllerGetStateAction } from "@metamask/network-controller";
|
6
6
|
import type { RemoteFeatureFlagControllerGetStateAction } from "@metamask/remote-feature-flag-controller";
|
7
7
|
import type { HandleSnapRequest } from "@metamask/snaps-controllers";
|
8
|
+
import type { Infer } from "@metamask/superstruct";
|
8
9
|
import type { TransactionControllerGetStateAction, TransactionControllerTransactionConfirmedEvent, TransactionControllerTransactionFailedEvent, TransactionMeta } from "@metamask/transaction-controller";
|
9
10
|
import type { BridgeStatusController } from "./bridge-status-controller.mjs";
|
10
11
|
import type { BRIDGE_STATUS_CONTROLLER_NAME } from "./constants.mjs";
|
12
|
+
import type { StatusResponseSchema } from "./utils/validators.mjs";
|
11
13
|
export declare enum BridgeClientId {
|
12
14
|
EXTENSION = "extension",
|
13
15
|
MOBILE = "mobile"
|
@@ -40,36 +42,6 @@ export type StatusRequestDto = Omit<StatusRequest, 'quote' | 'srcChainId' | 'des
|
|
40
42
|
export type StatusRequestWithSrcTxHash = StatusRequest & {
|
41
43
|
srcTxHash: string;
|
42
44
|
};
|
43
|
-
export type Asset = {
|
44
|
-
chainId: ChainId;
|
45
|
-
address: string;
|
46
|
-
symbol: string;
|
47
|
-
name: string;
|
48
|
-
decimals: number;
|
49
|
-
icon?: string | null;
|
50
|
-
};
|
51
|
-
export type SrcChainStatus = {
|
52
|
-
chainId: ChainId;
|
53
|
-
/**
|
54
|
-
* The txHash of the transaction on the source chain.
|
55
|
-
* This might be undefined for smart transactions (STX)
|
56
|
-
*/
|
57
|
-
txHash?: string;
|
58
|
-
/**
|
59
|
-
* The atomic amount of the token sent minus fees on the source chain
|
60
|
-
*/
|
61
|
-
amount?: string;
|
62
|
-
token?: Record<string, never> | Asset;
|
63
|
-
};
|
64
|
-
export type DestChainStatus = {
|
65
|
-
chainId: ChainId;
|
66
|
-
txHash?: string;
|
67
|
-
/**
|
68
|
-
* The atomic amount of the token received on the destination chain
|
69
|
-
*/
|
70
|
-
amount?: string;
|
71
|
-
token?: Record<string, never> | Asset;
|
72
|
-
};
|
73
45
|
export declare enum BridgeId {
|
74
46
|
HOP = "hop",
|
75
47
|
CELER = "celer",
|
@@ -84,45 +56,8 @@ export declare enum BridgeId {
|
|
84
56
|
RELAY = "relay",
|
85
57
|
MAYAN = "mayan"
|
86
58
|
}
|
87
|
-
export
|
88
|
-
METABRIDGE = "metabridge",
|
89
|
-
REFUEL = "refuel"
|
90
|
-
}
|
91
|
-
export type FeeData = {
|
92
|
-
amount: string;
|
93
|
-
asset: Asset;
|
94
|
-
};
|
95
|
-
export type Protocol = {
|
96
|
-
displayName?: string;
|
97
|
-
icon?: string;
|
98
|
-
name?: string;
|
99
|
-
};
|
100
|
-
export declare enum ActionTypes {
|
101
|
-
BRIDGE = "bridge",
|
102
|
-
SWAP = "swap",
|
103
|
-
REFUEL = "refuel"
|
104
|
-
}
|
105
|
-
export type Step = {
|
106
|
-
action: ActionTypes;
|
107
|
-
srcChainId: ChainId;
|
108
|
-
destChainId?: ChainId;
|
109
|
-
srcAsset: Asset;
|
110
|
-
destAsset: Asset;
|
111
|
-
srcAmount: string;
|
112
|
-
destAmount: string;
|
113
|
-
protocol: Protocol;
|
114
|
-
};
|
115
|
-
export type StatusResponse = {
|
116
|
-
status: StatusTypes;
|
117
|
-
srcChain: SrcChainStatus;
|
118
|
-
destChain?: DestChainStatus;
|
119
|
-
bridge?: BridgeId;
|
120
|
-
isExpectedToken?: boolean;
|
121
|
-
isUnrecognizedRouterAddress?: boolean;
|
122
|
-
refuel?: RefuelStatusResponse;
|
123
|
-
};
|
59
|
+
export type StatusResponse = Infer<typeof StatusResponseSchema>;
|
124
60
|
export type RefuelStatusResponse = object & StatusResponse;
|
125
|
-
export type RefuelData = object & Step;
|
126
61
|
export type BridgeHistoryItem = {
|
127
62
|
txMetaId: string;
|
128
63
|
quote: Quote;
|
@@ -133,12 +68,12 @@ export type BridgeHistoryItem = {
|
|
133
68
|
completionTime?: number;
|
134
69
|
pricingData?: {
|
135
70
|
/**
|
136
|
-
*
|
71
|
+
* The actual amount sent by user in non-atomic decimal form
|
137
72
|
*/
|
138
|
-
amountSent:
|
139
|
-
amountSentInUsd?:
|
140
|
-
quotedGasInUsd?:
|
141
|
-
quotedReturnInUsd?:
|
73
|
+
amountSent: QuoteMetadata['sentAmount']['amount'];
|
74
|
+
amountSentInUsd?: QuoteMetadata['sentAmount']['usd'];
|
75
|
+
quotedGasInUsd?: QuoteMetadata['gasFee']['usd'];
|
76
|
+
quotedReturnInUsd?: QuoteMetadata['toTokenAmount']['usd'];
|
142
77
|
quotedRefuelSrcAmountInUsd?: string;
|
143
78
|
quotedRefuelDestAmountInUsd?: string;
|
144
79
|
};
|
package/dist/types.d.mts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2CAA2C,EAC3C,oDAAoD,EACrD,sCAAsC;AACvC,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,EACpB,kCAAkC;AACnC,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACtB,OAAO,EACP,KAAK,EACL,aAAa,EACb,aAAa,EACb,
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":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,kBAAkB,CAAC,kBAAkB,CAAC,CAAC;AAEtE,MAAM,MAAM,sCAAsC,GAChD,4BAA4B,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;AAE/D,MAAM,MAAM,oCAAoC,GAC9C,4BAA4B,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;AAE7D,MAAM,MAAM,6BAA6B,GACrC,yDAAyD,GACzD,4CAA4C,GAC5C,sCAAsC,GACtC,oCAAoC,GACpC,oCAAoC,CAAC;AAGzC,MAAM,MAAM,sCAAsC,GAAG,0BAA0B,CAC7E,OAAO,6BAA6B,EACpC,2BAA2B,CAC5B,CAAC;AAEF,MAAM,MAAM,4BAA4B,GACtC,sCAAsC,CAAC;AAEzC;;GAEG;AACH,KAAK,cAAc,GACf,mDAAmD,GACnD,+BAA+B,GAC/B,2CAA2C,GAC3C,oDAAoD,GACpD,iBAAiB,GACjB,mCAAmC,GACnC,sBAAsB,CAAC,sBAAsB,CAAC,0BAA0B,CAAC,GACzE,sBAAsB,CAAC,sBAAsB,CAAC,uBAAuB,CAAC,GACtE,sBAAsB,CAAC,sBAAsB,CAAC,uBAAuB,CAAC,GACtE,cAAc,GACd,2CAA2C,GAC3C,yCAAyC,CAAC;AAE9C;;GAEG;AACH,KAAK,aAAa,GACd,2CAA2C,GAC3C,8CAA8C,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,+BAA+B,GAAG,mBAAmB,CAC/D,OAAO,6BAA6B,EACpC,6BAA6B,GAAG,cAAc,EAC9C,4BAA4B,GAAG,aAAa,EAC5C,cAAc,CAAC,MAAM,CAAC,EACtB,aAAa,CAAC,MAAM,CAAC,CACtB,CAAC"}
|
package/dist/types.mjs
CHANGED
@@ -20,17 +20,6 @@ export var BridgeId;
|
|
20
20
|
BridgeId["RELAY"] = "relay";
|
21
21
|
BridgeId["MAYAN"] = "mayan";
|
22
22
|
})(BridgeId || (BridgeId = {}));
|
23
|
-
export var FeeType;
|
24
|
-
(function (FeeType) {
|
25
|
-
FeeType["METABRIDGE"] = "metabridge";
|
26
|
-
FeeType["REFUEL"] = "refuel";
|
27
|
-
})(FeeType || (FeeType = {}));
|
28
|
-
export var ActionTypes;
|
29
|
-
(function (ActionTypes) {
|
30
|
-
ActionTypes["BRIDGE"] = "bridge";
|
31
|
-
ActionTypes["SWAP"] = "swap";
|
32
|
-
ActionTypes["REFUEL"] = "refuel";
|
33
|
-
})(ActionTypes || (ActionTypes = {}));
|
34
23
|
export var BridgeStatusAction;
|
35
24
|
(function (BridgeStatusAction) {
|
36
25
|
BridgeStatusAction["START_POLLING_FOR_BRIDGE_TX_STATUS"] = "startPollingForBridgeTxStatus";
|
package/dist/types.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAqCA,8EAA8E;AAC9E,2BAA2B;AAE3B,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AA2ED,MAAM,CAAN,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,KAAR,QAAQ,QAanB;AAED,MAAM,CAAN,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,oCAAyB,CAAA;IACzB,4BAAiB,CAAA;AACnB,CAAC,EAHW,OAAO,KAAP,OAAO,QAGlB;AAaD,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,gCAAiB,CAAA;AACnB,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAsDD,MAAM,CAAN,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,0FAAoE,CAAA;IACpE,6DAAuC,CAAA;IACvC,4CAAsB,CAAA;IACtB,gDAA0B,CAAA;IAC1B,4CAAsB,CAAA;AACxB,CAAC,EANW,kBAAkB,KAAlB,kBAAkB,QAM7B","sourcesContent":["import type {\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerGetSelectedMultichainAccountAction,\n} from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n RestrictedMessenger,\n} from '@metamask/base-controller';\nimport type {\n BridgeBackgroundAction,\n BridgeControllerAction,\n ChainId,\n Quote,\n QuoteMetadata,\n QuoteResponse,\n StatusTypes,\n TxData,\n} from '@metamask/bridge-controller';\nimport type { GetGasFeeState } from '@metamask/gas-fee-controller';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n NetworkControllerGetStateAction,\n} from '@metamask/network-controller';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type { HandleSnapRequest } from '@metamask/snaps-controllers';\nimport type {\n TransactionControllerGetStateAction,\n TransactionControllerTransactionConfirmedEvent,\n TransactionControllerTransactionFailedEvent,\n TransactionMeta,\n} from '@metamask/transaction-controller';\n\nimport type { BridgeStatusController } from './bridge-status-controller';\nimport type { BRIDGE_STATUS_CONTROLLER_NAME } from './constants';\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n) => Promise<any>;\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 type Asset = {\n chainId: ChainId;\n address: string;\n symbol: string;\n name: string;\n decimals: number;\n icon?: string | null;\n};\n\nexport type SrcChainStatus = {\n chainId: ChainId;\n /**\n * The txHash of the transaction on the source chain.\n * This might be undefined for smart transactions (STX)\n */\n txHash?: string;\n /**\n * The atomic amount of the token sent minus fees on the source chain\n */\n amount?: string;\n token?: Record<string, never> | Asset;\n};\n\nexport type DestChainStatus = {\n chainId: ChainId;\n txHash?: string;\n /**\n * The atomic amount of the token received on the destination chain\n */\n amount?: string;\n token?: Record<string, never> | Asset;\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 enum FeeType {\n METABRIDGE = 'metabridge',\n REFUEL = 'refuel',\n}\n\nexport type FeeData = {\n amount: string;\n asset: Asset;\n};\n\nexport type Protocol = {\n displayName?: string;\n icon?: string;\n name?: string; // for legacy quotes\n};\n\nexport enum ActionTypes {\n BRIDGE = 'bridge',\n SWAP = 'swap',\n REFUEL = 'refuel',\n}\n\nexport type Step = {\n action: ActionTypes;\n srcChainId: ChainId;\n destChainId?: ChainId;\n srcAsset: Asset;\n destAsset: Asset;\n srcAmount: string;\n destAmount: string;\n protocol: Protocol;\n};\n\nexport type StatusResponse = {\n status: StatusTypes;\n srcChain: SrcChainStatus;\n destChain?: DestChainStatus;\n bridge?: BridgeId;\n isExpectedToken?: boolean;\n isUnrecognizedRouterAddress?: boolean;\n refuel?: RefuelStatusResponse;\n};\n\nexport type RefuelStatusResponse = object & StatusResponse;\n\nexport type RefuelData = object & Step;\n\nexport type BridgeHistoryItem = {\n txMetaId: string; // Need this to handle STX that might not have a txHash immediately\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 * From QuoteMetadata.sentAmount.amount, the actual amount sent by user in non-atomic decimal form\n */\n amountSent: string;\n amountSentInUsd?: string;\n quotedGasInUsd?: string; // from QuoteMetadata.gasFee.usd\n quotedReturnInUsd?: string; // from 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 isStxEnabled?: boolean;\n};\n\nexport enum BridgeStatusAction {\n START_POLLING_FOR_BRIDGE_TX_STATUS = 'startPollingForBridgeTxStatus',\n WIPE_BRIDGE_STATUS = 'wipeBridgeStatus',\n GET_STATE = 'getState',\n RESET_STATE = 'resetState',\n SUBMIT_TX = 'submitTx',\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: TransactionMeta;\n statusRequest: StatusRequest;\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};\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<string | TxData> & QuoteMetadata;\n};\n\nexport type SourceChainTxMetaId = string;\n\nexport type BridgeStatusControllerState = {\n txHistory: Record<SourceChainTxMetaId, BridgeHistoryItem>;\n};\n\n// Actions\ntype BridgeStatusControllerAction<\n FunctionName extends keyof BridgeStatusController,\n> = {\n type: `${typeof BRIDGE_STATUS_CONTROLLER_NAME}:${FunctionName}`;\n handler: BridgeStatusController[FunctionName];\n};\n\nexport type BridgeStatusControllerGetStateAction = ControllerGetStateAction<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\n// Maps to BridgeController function names\nexport type BridgeStatusControllerStartPollingForBridgeTxStatusAction =\n BridgeStatusControllerAction<BridgeStatusAction.START_POLLING_FOR_BRIDGE_TX_STATUS>;\n\nexport type BridgeStatusControllerWipeBridgeStatusAction =\n BridgeStatusControllerAction<BridgeStatusAction.WIPE_BRIDGE_STATUS>;\n\nexport type BridgeStatusControllerResetStateAction =\n BridgeStatusControllerAction<BridgeStatusAction.RESET_STATE>;\n\nexport type BridgeStatusControllerSubmitTxAction =\n BridgeStatusControllerAction<BridgeStatusAction.SUBMIT_TX>;\n\nexport type BridgeStatusControllerActions =\n | BridgeStatusControllerStartPollingForBridgeTxStatusAction\n | BridgeStatusControllerWipeBridgeStatusAction\n | BridgeStatusControllerResetStateAction\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerSubmitTxAction;\n\n// Events\nexport type BridgeStatusControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\nexport type BridgeStatusControllerEvents =\n BridgeStatusControllerStateChangeEvent;\n\n/**\n * The external actions available to the BridgeStatusController.\n */\ntype AllowedActions =\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | AccountsControllerGetSelectedMultichainAccountAction\n | HandleSnapRequest\n | TransactionControllerGetStateAction\n | BridgeControllerAction<BridgeBackgroundAction.GET_BRIDGE_ERC20_ALLOWANCE>\n | BridgeControllerAction<BridgeBackgroundAction.TRACK_METAMETRICS_EVENT>\n | BridgeControllerAction<BridgeBackgroundAction.STOP_POLLING_FOR_QUOTES>\n | GetGasFeeState\n | AccountsControllerGetAccountByAddressAction\n | RemoteFeatureFlagControllerGetStateAction;\n\n/**\n * The external events available to the BridgeStatusController.\n */\ntype AllowedEvents =\n | TransactionControllerTransactionFailedEvent\n | TransactionControllerTransactionConfirmedEvent;\n\n/**\n * The messenger for the BridgeStatusController.\n */\nexport type BridgeStatusControllerMessenger = RestrictedMessenger<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerActions | AllowedActions,\n BridgeStatusControllerEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n"]}
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAsCA,8EAA8E;AAC9E,2BAA2B;AAE3B,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AA0CD,MAAM,CAAN,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,KAAR,QAAQ,QAanB;AAiCD,MAAM,CAAN,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,0FAAoE,CAAA;IACpE,6DAAuC,CAAA;IACvC,4CAAsB,CAAA;IACtB,gDAA0B,CAAA;IAC1B,4CAAsB,CAAA;AACxB,CAAC,EANW,kBAAkB,KAAlB,kBAAkB,QAM7B","sourcesContent":["import type {\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerGetSelectedMultichainAccountAction,\n} from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n RestrictedMessenger,\n} from '@metamask/base-controller';\nimport type {\n BridgeBackgroundAction,\n BridgeControllerAction,\n ChainId,\n Quote,\n QuoteMetadata,\n QuoteResponse,\n TxData,\n} from '@metamask/bridge-controller';\nimport type { GetGasFeeState } from '@metamask/gas-fee-controller';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n NetworkControllerGetStateAction,\n} from '@metamask/network-controller';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type { HandleSnapRequest } from '@metamask/snaps-controllers';\nimport type { Infer } from '@metamask/superstruct';\nimport type {\n TransactionControllerGetStateAction,\n TransactionControllerTransactionConfirmedEvent,\n TransactionControllerTransactionFailedEvent,\n TransactionMeta,\n} from '@metamask/transaction-controller';\n\nimport type { BridgeStatusController } from './bridge-status-controller';\nimport type { 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n) => Promise<any>;\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\nexport type BridgeHistoryItem = {\n txMetaId: string; // Need this to handle STX that might not have a txHash immediately\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']['usd'];\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 isStxEnabled?: boolean;\n};\n\nexport enum BridgeStatusAction {\n START_POLLING_FOR_BRIDGE_TX_STATUS = 'startPollingForBridgeTxStatus',\n WIPE_BRIDGE_STATUS = 'wipeBridgeStatus',\n GET_STATE = 'getState',\n RESET_STATE = 'resetState',\n SUBMIT_TX = 'submitTx',\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: TransactionMeta;\n statusRequest: StatusRequest;\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};\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<string | TxData> & QuoteMetadata;\n};\n\nexport type SourceChainTxMetaId = string;\n\nexport type BridgeStatusControllerState = {\n txHistory: Record<SourceChainTxMetaId, BridgeHistoryItem>;\n};\n\n// Actions\ntype BridgeStatusControllerAction<\n FunctionName extends keyof BridgeStatusController,\n> = {\n type: `${typeof BRIDGE_STATUS_CONTROLLER_NAME}:${FunctionName}`;\n handler: BridgeStatusController[FunctionName];\n};\n\nexport type BridgeStatusControllerGetStateAction = ControllerGetStateAction<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\n// Maps to BridgeController function names\nexport type BridgeStatusControllerStartPollingForBridgeTxStatusAction =\n BridgeStatusControllerAction<BridgeStatusAction.START_POLLING_FOR_BRIDGE_TX_STATUS>;\n\nexport type BridgeStatusControllerWipeBridgeStatusAction =\n BridgeStatusControllerAction<BridgeStatusAction.WIPE_BRIDGE_STATUS>;\n\nexport type BridgeStatusControllerResetStateAction =\n BridgeStatusControllerAction<BridgeStatusAction.RESET_STATE>;\n\nexport type BridgeStatusControllerSubmitTxAction =\n BridgeStatusControllerAction<BridgeStatusAction.SUBMIT_TX>;\n\nexport type BridgeStatusControllerActions =\n | BridgeStatusControllerStartPollingForBridgeTxStatusAction\n | BridgeStatusControllerWipeBridgeStatusAction\n | BridgeStatusControllerResetStateAction\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerSubmitTxAction;\n\n// Events\nexport type BridgeStatusControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\nexport type BridgeStatusControllerEvents =\n BridgeStatusControllerStateChangeEvent;\n\n/**\n * The external actions available to the BridgeStatusController.\n */\ntype AllowedActions =\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | AccountsControllerGetSelectedMultichainAccountAction\n | HandleSnapRequest\n | TransactionControllerGetStateAction\n | BridgeControllerAction<BridgeBackgroundAction.GET_BRIDGE_ERC20_ALLOWANCE>\n | BridgeControllerAction<BridgeBackgroundAction.TRACK_METAMETRICS_EVENT>\n | BridgeControllerAction<BridgeBackgroundAction.STOP_POLLING_FOR_QUOTES>\n | GetGasFeeState\n | AccountsControllerGetAccountByAddressAction\n | RemoteFeatureFlagControllerGetStateAction;\n\n/**\n * The external events available to the BridgeStatusController.\n */\ntype AllowedEvents =\n | TransactionControllerTransactionFailedEvent\n | TransactionControllerTransactionConfirmedEvent;\n\n/**\n * The messenger for the BridgeStatusController.\n */\nexport type BridgeStatusControllerMessenger = RestrictedMessenger<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerActions | AllowedActions,\n BridgeStatusControllerEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n"]}
|
package/dist/utils/metrics.cjs
CHANGED
@@ -56,7 +56,7 @@ exports.getRequestParamFromHistory = getRequestParamFromHistory;
|
|
56
56
|
const getTradeDataFromQuote = (quoteResponse) => {
|
57
57
|
return {
|
58
58
|
usd_quoted_gas: Number(quoteResponse.gasFee?.usd ?? 0),
|
59
|
-
gas_included: false,
|
59
|
+
gas_included: quoteResponse.quote.gasIncluded ?? false,
|
60
60
|
provider: (0, bridge_controller_1.formatProviderLabel)(quoteResponse.quote),
|
61
61
|
quoted_time_minutes: Number(quoteResponse.estimatedProcessingTimeInSeconds / 60),
|
62
62
|
usd_quoted_return: Number(quoteResponse.adjustedReturn?.usd ?? 0),
|
@@ -70,7 +70,7 @@ exports.getPriceImpactFromQuote = getPriceImpactFromQuote;
|
|
70
70
|
const getTradeDataFromHistory = (historyItem) => {
|
71
71
|
return {
|
72
72
|
usd_quoted_gas: Number(historyItem.pricingData?.quotedGasInUsd ?? 0),
|
73
|
-
gas_included: false,
|
73
|
+
gas_included: historyItem.quote.gasIncluded ?? false,
|
74
74
|
provider: (0, bridge_controller_1.formatProviderLabel)(historyItem.quote),
|
75
75
|
quoted_time_minutes: Number(historyItem.estimatedProcessingTimeInSeconds / 60),
|
76
76
|
usd_quoted_return: Number(historyItem.pricingData?.quotedReturnInUsd ?? 0),
|