@metamask-previews/sentinel-api-service 2.1.0-preview-7410208d2 → 2.1.0-preview-e53b41ba2
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 +1 -14
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/sentinel-api-service-method-action-types.d.ts +1 -48
- package/dist/sentinel-api-service-method-action-types.d.ts.map +1 -1
- package/dist/sentinel-api-service-method-action-types.js.map +1 -1
- package/dist/sentinel-api-service.d.ts +1 -44
- package/dist/sentinel-api-service.d.ts.map +1 -1
- package/dist/sentinel-api-service.js +1 -209
- package/dist/sentinel-api-service.js.map +1 -1
- package/dist/structs.d.ts +0 -104
- package/dist/structs.d.ts.map +1 -1
- package/dist/structs.js +0 -60
- package/dist/structs.js.map +1 -1
- package/dist/types.d.ts +1 -240
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -69
- package/dist/types.js.map +1 -1
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -9,25 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
|
-
- Add optional `accountHardwareType` to `SentinelMeta` for relay transaction metadata ([#10842](https://github.com/MetaMask/core/pull/10842))
|
|
13
|
-
- Add `getFees`, `submitTransactions`, `cancel`, and `getBatchStatus` methods, with matching `SentinelApiService:*` actions, for smart-transaction fee quotes, submission, cancellation, and status lookup ([#11272](https://github.com/MetaMask/core/pull/11272))
|
|
14
|
-
- `getFees` quotes gas fees via `POST /v1/networks/{chainId}/getFees`. Accepts a `SentinelGetFeesRequest` and returns a `SentinelGetFeesResponse`. Each transaction is a `SentinelSimulationTransaction`, the object `infura_simulateTransactions` accepts. The handler forwards them as the `txs` array.
|
|
15
|
-
- `submitTransactions` submits signed smart transactions via `POST /v1/networks/{chainId}/submitTransactions`. Accepts a `SentinelSubmitTransactionsRequest` (`rawTxs`, optional `rawCancelTxs`, optional `rawTxsWithMetadata`) and returns a `SentinelSubmitTransactionsResponse` (`uuid`).
|
|
16
|
-
- `cancel` cancels a smart transaction via `POST /v1/networks/{chainId}/cancel`. Accepts a `SentinelCancelRequest` (`chainId`, `uuid`) and returns a `SentinelCancelResponse` (`uuid`, `affected`, `cancelled`).
|
|
17
|
-
- `getBatchStatus` looks up the status of several smart transactions via `GET /v1/networks/{chainId}/batchStatus`. Accepts a `SentinelBatchStatusRequest` (`chainId`, `uuids`) and returns a `SentinelBatchStatusResponse`, a record keyed by UUID whose values are `SentinelBatchedTransactionStatus`. Adds the `SentinelCancellationReason`, `SentinelMinedTxStatus`, and `SentinelOriginalTransactionStatus` enums for the closed-set status fields.
|
|
18
|
-
- None of these methods are cached. Each throws `SentinelChainNotSupportedError` when the chain is missing from the registry or does not enable `confirmations`. A non-2xx response throws `HttpError` with the response body on `data` when it is JSON.
|
|
19
12
|
- Add optional `suggestFees.withRedeemerEnforcer` property to `SentinelSimulationRequest`, optional `balance` property to `SentinelStateOverrides`, and optional `sponsorship.sponsor` property to `SentinelSimulationResponse` ([#9476](https://github.com/MetaMask/core/pull/9476))
|
|
20
13
|
- Add support for Node.js 26 ([#10981](https://github.com/MetaMask/core/pull/10981))
|
|
21
14
|
|
|
22
15
|
### Changed
|
|
23
16
|
|
|
24
|
-
-
|
|
25
|
-
- Bump `@metamask/utils` from `^12.0.0` to `^12.0.2` ([#11107](https://github.com/MetaMask/core/pull/11107), [#11474](https://github.com/MetaMask/core/pull/11474))
|
|
26
|
-
|
|
27
|
-
### Deprecated
|
|
28
|
-
|
|
29
|
-
- Deprecate the `SentinelKind` enum and the `SentinelMeta.kind` and `SentinelMeta.wallet` properties, which Sentinel no longer takes in its metadata ([#11272](https://github.com/MetaMask/core/pull/11272))
|
|
30
|
-
- They will be removed in a future major version.
|
|
17
|
+
- Bump `@metamask/utils` from `^12.0.0` to `^12.0.1` ([#11107](https://github.com/MetaMask/core/pull/11107))
|
|
31
18
|
|
|
32
19
|
## [2.1.0]
|
|
33
20
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { SentinelApiService } from './sentinel-api-service.js';
|
|
2
2
|
export { SentinelEnvironment, serviceName } from './constants.js';
|
|
3
|
-
export type { SentinelApiServiceActions, SentinelApiServiceEvents, SentinelApiServiceMessenger, SentinelApiServiceOptions, SentinelApiServiceInvalidateQueriesAction, SentinelApiServiceCacheUpdatedEvent, SentinelApiServiceGranularCacheUpdatedEvent, SentinelAuthorization,
|
|
4
|
-
export {
|
|
5
|
-
export type {
|
|
3
|
+
export type { SentinelApiServiceActions, SentinelApiServiceEvents, SentinelApiServiceMessenger, SentinelApiServiceOptions, SentinelApiServiceInvalidateQueriesAction, SentinelApiServiceCacheUpdatedEvent, SentinelApiServiceGranularCacheUpdatedEvent, SentinelAuthorization, SentinelMeta, SentinelNetwork, SentinelNetworkRegistry, SentinelRelaySubmitRequest, SentinelRelaySubmitResponse, SentinelSignedAuthorization, SentinelSimulationCallTrace, SentinelSimulationLog, SentinelSimulationRequest, SentinelSimulationResponse, SentinelSimulationResponseTransaction, SentinelSimulationStateDiff, SentinelSimulationTokenFee, SentinelSimulationTransaction, SentinelSmartTransaction, SentinelSmartTransactionRequest, SentinelSmartTransactionResponse, SentinelStateOverrides, } from './types.js';
|
|
4
|
+
export { SentinelFeature, SentinelKind, SentinelSmartTransactionStatus, } from './types.js';
|
|
5
|
+
export type { SentinelApiServiceGetNetworkAction, SentinelApiServiceGetNetworksAction, SentinelApiServiceSimulateTransactionsAction, SentinelApiServiceSubmitRelayTransactionAction, SentinelApiServiceGetSmartTransactionAction, } from './sentinel-api-service-method-action-types.js';
|
|
6
6
|
export { SentinelApiResponseValidationError, SentinelChainNotSupportedError, SentinelJsonRpcError, } from './errors.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClE,YAAY,EACV,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,yCAAyC,EACzC,mCAAmC,EACnC,2CAA2C,EAC3C,qBAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClE,YAAY,EACV,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,yCAAyC,EACzC,mCAAmC,EACnC,2CAA2C,EAC3C,qBAAqB,EACrB,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,2BAA2B,EAC3B,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,qCAAqC,EACrC,2BAA2B,EAC3B,0BAA0B,EAC1B,6BAA6B,EAC7B,wBAAwB,EACxB,+BAA+B,EAC/B,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,YAAY,EACZ,8BAA8B,GAC/B,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,kCAAkC,EAClC,mCAAmC,EACnC,4CAA4C,EAC5C,8CAA8C,EAC9C,2CAA2C,GAC5C,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,kCAAkC,EAClC,8BAA8B,EAC9B,oBAAoB,GACrB,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { SentinelApiService } from './sentinel-api-service.js';
|
|
2
2
|
export { SentinelEnvironment, serviceName } from './constants.js';
|
|
3
|
-
export {
|
|
3
|
+
export { SentinelFeature, SentinelKind, SentinelSmartTransactionStatus, } from './types.js';
|
|
4
4
|
export { SentinelApiResponseValidationError, SentinelChainNotSupportedError, SentinelJsonRpcError, } from './errors.js';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA6BlE,OAAO,EACL,eAAe,EACf,YAAY,EACZ,8BAA8B,GAC/B,MAAM,YAAY,CAAC;AAQpB,OAAO,EACL,kCAAkC,EAClC,8BAA8B,EAC9B,oBAAoB,GACrB,MAAM,aAAa,CAAC","sourcesContent":["export { SentinelApiService } from './sentinel-api-service.js';\nexport { SentinelEnvironment, serviceName } from './constants.js';\nexport type {\n SentinelApiServiceActions,\n SentinelApiServiceEvents,\n SentinelApiServiceMessenger,\n SentinelApiServiceOptions,\n SentinelApiServiceInvalidateQueriesAction,\n SentinelApiServiceCacheUpdatedEvent,\n SentinelApiServiceGranularCacheUpdatedEvent,\n SentinelAuthorization,\n SentinelMeta,\n SentinelNetwork,\n SentinelNetworkRegistry,\n SentinelRelaySubmitRequest,\n SentinelRelaySubmitResponse,\n SentinelSignedAuthorization,\n SentinelSimulationCallTrace,\n SentinelSimulationLog,\n SentinelSimulationRequest,\n SentinelSimulationResponse,\n SentinelSimulationResponseTransaction,\n SentinelSimulationStateDiff,\n SentinelSimulationTokenFee,\n SentinelSimulationTransaction,\n SentinelSmartTransaction,\n SentinelSmartTransactionRequest,\n SentinelSmartTransactionResponse,\n SentinelStateOverrides,\n} from './types.js';\nexport {\n SentinelFeature,\n SentinelKind,\n SentinelSmartTransactionStatus,\n} from './types.js';\nexport type {\n SentinelApiServiceGetNetworkAction,\n SentinelApiServiceGetNetworksAction,\n SentinelApiServiceSimulateTransactionsAction,\n SentinelApiServiceSubmitRelayTransactionAction,\n SentinelApiServiceGetSmartTransactionAction,\n} from './sentinel-api-service-method-action-types.js';\nexport {\n SentinelApiResponseValidationError,\n SentinelChainNotSupportedError,\n SentinelJsonRpcError,\n} from './errors.js';\n"]}
|
|
@@ -68,55 +68,8 @@ export type SentinelApiServiceGetSmartTransactionAction = {
|
|
|
68
68
|
type: `SentinelApiService:getSmartTransaction`;
|
|
69
69
|
handler: SentinelApiService['getSmartTransaction'];
|
|
70
70
|
};
|
|
71
|
-
/**
|
|
72
|
-
* Quotes gas fees for unsigned smart transactions via
|
|
73
|
-
* `POST /v1/networks/{chainId}/getFees`. Not cached, since a quote goes
|
|
74
|
-
* stale immediately.
|
|
75
|
-
*
|
|
76
|
-
* @param request - The fee quote request.
|
|
77
|
-
* @returns The fee quote response. One entry in `txs` per transaction, in
|
|
78
|
-
* request order.
|
|
79
|
-
*/
|
|
80
|
-
export type SentinelApiServiceGetFeesAction = {
|
|
81
|
-
type: `SentinelApiService:getFees`;
|
|
82
|
-
handler: SentinelApiService['getFees'];
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Submits signed smart transactions via
|
|
86
|
-
* `POST /v1/networks/{chainId}/submitTransactions`. Not cached.
|
|
87
|
-
*
|
|
88
|
-
* @param request - The submit request.
|
|
89
|
-
* @returns The UUID assigned to the submitted batch.
|
|
90
|
-
*/
|
|
91
|
-
export type SentinelApiServiceSubmitTransactionsAction = {
|
|
92
|
-
type: `SentinelApiService:submitTransactions`;
|
|
93
|
-
handler: SentinelApiService['submitTransactions'];
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* Cancels a smart transaction via `POST /v1/networks/{chainId}/cancel`.
|
|
97
|
-
* Not cached.
|
|
98
|
-
*
|
|
99
|
-
* @param request - The cancel request.
|
|
100
|
-
* @returns The cancel result. `cancelled` is `true` on success.
|
|
101
|
-
*/
|
|
102
|
-
export type SentinelApiServiceCancelAction = {
|
|
103
|
-
type: `SentinelApiService:cancel`;
|
|
104
|
-
handler: SentinelApiService['cancel'];
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Looks up the statuses of several smart transactions via
|
|
108
|
-
* `GET /v1/networks/{chainId}/batchStatus`. Not cached, since statuses change
|
|
109
|
-
* while transactions are pending.
|
|
110
|
-
*
|
|
111
|
-
* @param request - The batch status request.
|
|
112
|
-
* @returns The status of each requested transaction, keyed by UUID.
|
|
113
|
-
*/
|
|
114
|
-
export type SentinelApiServiceGetBatchStatusAction = {
|
|
115
|
-
type: `SentinelApiService:getBatchStatus`;
|
|
116
|
-
handler: SentinelApiService['getBatchStatus'];
|
|
117
|
-
};
|
|
118
71
|
/**
|
|
119
72
|
* Union of all SentinelApiService action types.
|
|
120
73
|
*/
|
|
121
|
-
export type SentinelApiServiceMethodActions = SentinelApiServiceGetNetworkAction | SentinelApiServiceGetNetworksAction | SentinelApiServiceSimulateTransactionsAction | SentinelApiServiceSubmitRelayTransactionAction | SentinelApiServiceGetSmartTransactionAction
|
|
74
|
+
export type SentinelApiServiceMethodActions = SentinelApiServiceGetNetworkAction | SentinelApiServiceGetNetworksAction | SentinelApiServiceSimulateTransactionsAction | SentinelApiServiceSubmitRelayTransactionAction | SentinelApiServiceGetSmartTransactionAction;
|
|
122
75
|
//# sourceMappingURL=sentinel-api-service-method-action-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentinel-api-service-method-action-types.d.ts","sourceRoot":"","sources":["../src/sentinel-api-service-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;;;;;;;GAQG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,kBAAkB,CAAC,wBAAwB,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE,wCAAwC,CAAC;IAC/C,OAAO,EAAE,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;CACpD,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"sentinel-api-service-method-action-types.d.ts","sourceRoot":"","sources":["../src/sentinel-api-service-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;;;;;;;GAQG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,kBAAkB,CAAC,wBAAwB,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE,wCAAwC,CAAC;IAC/C,OAAO,EAAE,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;CACpD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,+BAA+B,GACvC,kCAAkC,GAClC,mCAAmC,GACnC,4CAA4C,GAC5C,8CAA8C,GAC9C,2CAA2C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentinel-api-service-method-action-types.js","sourceRoot":"","sources":["../src/sentinel-api-service-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SentinelApiService } from './sentinel-api-service.js';\n\n/**\n * Fetches the configuration of a single network from the `/network`\n * endpoint of that network's subdomain. The subdomain is resolved from the\n * supported-network registry. The result is cached, as the configuration is\n * stable.\n *\n * @param chainId - The chain ID of the network.\n * @returns The network configuration.\n */\nexport type SentinelApiServiceGetNetworkAction = {\n type: `SentinelApiService:getNetwork`;\n handler: SentinelApiService['getNetwork'];\n};\n\n/**\n * Fetches the Sentinel supported-network registry. The result is cached, as\n * the registry is stable and identical across network subdomains.\n *\n * @returns The network registry, keyed by decimal chain ID.\n */\nexport type SentinelApiServiceGetNetworksAction = {\n type: `SentinelApiService:getNetworks`;\n handler: SentinelApiService['getNetworks'];\n};\n\n/**\n * Simulates transactions against the Sentinel API via\n * `infura_simulateTransactions`. Not cached, since each request body is\n * unique and stale simulations must not be reused.\n *\n * @param chainId - The chain ID to simulate on.\n * @param request - The simulation request.\n * @param options - Additional options.\n * @param options.getUrl - Optional callback that receives the default\n * Sentinel URL resolved for the chain and returns the URL to use instead.\n * Lets consumers rewrite the request URL (for example to route through the\n * MetaMask Shield proxy) without the service knowing about those concerns.\n * @returns The simulation response.\n */\nexport type SentinelApiServiceSimulateTransactionsAction = {\n type: `SentinelApiService:simulateTransactions`;\n handler: SentinelApiService['simulateTransactions'];\n};\n\n/**\n * Submits a signed relay (gas station) transaction to the Sentinel API via\n * `eth_sendRelayTransaction`. Not cached.\n *\n * @param request - The relay submit request.\n * @returns The relay submit response containing the tracking UUID.\n */\nexport type SentinelApiServiceSubmitRelayTransactionAction = {\n type: `SentinelApiService:submitRelayTransaction`;\n handler: SentinelApiService['submitRelayTransaction'];\n};\n\n/**\n * Looks up the state of a submitted smart transaction by UUID against the\n * `/smart-transactions/{uuid}` endpoint. Performs a single request; callers\n * own any polling loop. Not cached.\n *\n * @param request - The smart-transaction lookup request.\n * @returns The response envelope containing the smart transaction(s)\n * associated with the requested UUID.\n */\nexport type SentinelApiServiceGetSmartTransactionAction = {\n type: `SentinelApiService:getSmartTransaction`;\n handler: SentinelApiService['getSmartTransaction'];\n};\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"sentinel-api-service-method-action-types.js","sourceRoot":"","sources":["../src/sentinel-api-service-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SentinelApiService } from './sentinel-api-service.js';\n\n/**\n * Fetches the configuration of a single network from the `/network`\n * endpoint of that network's subdomain. The subdomain is resolved from the\n * supported-network registry. The result is cached, as the configuration is\n * stable.\n *\n * @param chainId - The chain ID of the network.\n * @returns The network configuration.\n */\nexport type SentinelApiServiceGetNetworkAction = {\n type: `SentinelApiService:getNetwork`;\n handler: SentinelApiService['getNetwork'];\n};\n\n/**\n * Fetches the Sentinel supported-network registry. The result is cached, as\n * the registry is stable and identical across network subdomains.\n *\n * @returns The network registry, keyed by decimal chain ID.\n */\nexport type SentinelApiServiceGetNetworksAction = {\n type: `SentinelApiService:getNetworks`;\n handler: SentinelApiService['getNetworks'];\n};\n\n/**\n * Simulates transactions against the Sentinel API via\n * `infura_simulateTransactions`. Not cached, since each request body is\n * unique and stale simulations must not be reused.\n *\n * @param chainId - The chain ID to simulate on.\n * @param request - The simulation request.\n * @param options - Additional options.\n * @param options.getUrl - Optional callback that receives the default\n * Sentinel URL resolved for the chain and returns the URL to use instead.\n * Lets consumers rewrite the request URL (for example to route through the\n * MetaMask Shield proxy) without the service knowing about those concerns.\n * @returns The simulation response.\n */\nexport type SentinelApiServiceSimulateTransactionsAction = {\n type: `SentinelApiService:simulateTransactions`;\n handler: SentinelApiService['simulateTransactions'];\n};\n\n/**\n * Submits a signed relay (gas station) transaction to the Sentinel API via\n * `eth_sendRelayTransaction`. Not cached.\n *\n * @param request - The relay submit request.\n * @returns The relay submit response containing the tracking UUID.\n */\nexport type SentinelApiServiceSubmitRelayTransactionAction = {\n type: `SentinelApiService:submitRelayTransaction`;\n handler: SentinelApiService['submitRelayTransaction'];\n};\n\n/**\n * Looks up the state of a submitted smart transaction by UUID against the\n * `/smart-transactions/{uuid}` endpoint. Performs a single request; callers\n * own any polling loop. Not cached.\n *\n * @param request - The smart-transaction lookup request.\n * @returns The response envelope containing the smart transaction(s)\n * associated with the requested UUID.\n */\nexport type SentinelApiServiceGetSmartTransactionAction = {\n type: `SentinelApiService:getSmartTransaction`;\n handler: SentinelApiService['getSmartTransaction'];\n};\n\n/**\n * Union of all SentinelApiService action types.\n */\nexport type SentinelApiServiceMethodActions =\n | SentinelApiServiceGetNetworkAction\n | SentinelApiServiceGetNetworksAction\n | SentinelApiServiceSimulateTransactionsAction\n | SentinelApiServiceSubmitRelayTransactionAction\n | SentinelApiServiceGetSmartTransactionAction;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseDataService } from '@metamask/base-data-service';
|
|
2
2
|
import type { Hex } from '@metamask/utils';
|
|
3
3
|
import { serviceName } from './constants.js';
|
|
4
|
-
import type { SentinelApiServiceMessenger, SentinelApiServiceOptions,
|
|
4
|
+
import type { SentinelApiServiceMessenger, SentinelApiServiceOptions, SentinelNetwork, SentinelNetworkRegistry, SentinelRelaySubmitRequest, SentinelRelaySubmitResponse, SentinelSimulationRequest, SentinelSimulationResponse, SentinelSmartTransactionRequest, SentinelSmartTransactionResponse } from './types.js';
|
|
5
5
|
/**
|
|
6
6
|
* Data service that centralises all interactions with the MetaMask Sentinel
|
|
7
7
|
* API (`tx-sentinel-<network>.api.cx.metamask.io`).
|
|
@@ -18,14 +18,6 @@ import type { SentinelApiServiceMessenger, SentinelApiServiceOptions, SentinelBa
|
|
|
18
18
|
* submission (`eth_sendRelayTransaction`), used by the extension and mobile.
|
|
19
19
|
* - {@link SentinelApiService.getSmartTransaction} — smart-transaction status
|
|
20
20
|
* lookup (`/smart-transactions/{uuid}`).
|
|
21
|
-
* - {@link SentinelApiService.getFees} — smart-transaction fee quotes
|
|
22
|
-
* (`POST /v1/networks/{chainId}/getFees`). Not cached.
|
|
23
|
-
* - {@link SentinelApiService.submitTransactions} — signed smart-transaction
|
|
24
|
-
* submission (`POST /v1/networks/{chainId}/submitTransactions`). Not cached.
|
|
25
|
-
* - {@link SentinelApiService.cancel} — smart-transaction cancellation
|
|
26
|
-
* (`POST /v1/networks/{chainId}/cancel`). Not cached.
|
|
27
|
-
* - {@link SentinelApiService.getBatchStatus} — smart-transaction status lookup
|
|
28
|
-
* for several UUIDs (`GET /v1/networks/{chainId}/batchStatus`). Not cached.
|
|
29
21
|
*
|
|
30
22
|
* Consumers derive higher-level concerns (whether a chain supports simulation
|
|
31
23
|
* or relay, polling loops, etc.) from the raw endpoint responses.
|
|
@@ -106,40 +98,5 @@ export declare class SentinelApiService extends BaseDataService<typeof serviceNa
|
|
|
106
98
|
* associated with the requested UUID.
|
|
107
99
|
*/
|
|
108
100
|
getSmartTransaction(request: SentinelSmartTransactionRequest): Promise<SentinelSmartTransactionResponse>;
|
|
109
|
-
/**
|
|
110
|
-
* Quotes gas fees for unsigned smart transactions via
|
|
111
|
-
* `POST /v1/networks/{chainId}/getFees`. Not cached, since a quote goes
|
|
112
|
-
* stale immediately.
|
|
113
|
-
*
|
|
114
|
-
* @param request - The fee quote request.
|
|
115
|
-
* @returns The fee quote response. One entry in `txs` per transaction, in
|
|
116
|
-
* request order.
|
|
117
|
-
*/
|
|
118
|
-
getFees(request: SentinelGetFeesRequest): Promise<SentinelGetFeesResponse>;
|
|
119
|
-
/**
|
|
120
|
-
* Submits signed smart transactions via
|
|
121
|
-
* `POST /v1/networks/{chainId}/submitTransactions`. Not cached.
|
|
122
|
-
*
|
|
123
|
-
* @param request - The submit request.
|
|
124
|
-
* @returns The UUID assigned to the submitted batch.
|
|
125
|
-
*/
|
|
126
|
-
submitTransactions(request: SentinelSubmitTransactionsRequest): Promise<SentinelSubmitTransactionsResponse>;
|
|
127
|
-
/**
|
|
128
|
-
* Cancels a smart transaction via `POST /v1/networks/{chainId}/cancel`.
|
|
129
|
-
* Not cached.
|
|
130
|
-
*
|
|
131
|
-
* @param request - The cancel request.
|
|
132
|
-
* @returns The cancel result. `cancelled` is `true` on success.
|
|
133
|
-
*/
|
|
134
|
-
cancel(request: SentinelCancelRequest): Promise<SentinelCancelResponse>;
|
|
135
|
-
/**
|
|
136
|
-
* Looks up the statuses of several smart transactions via
|
|
137
|
-
* `GET /v1/networks/{chainId}/batchStatus`. Not cached, since statuses change
|
|
138
|
-
* while transactions are pending.
|
|
139
|
-
*
|
|
140
|
-
* @param request - The batch status request.
|
|
141
|
-
* @returns The status of each requested transaction, keyed by UUID.
|
|
142
|
-
*/
|
|
143
|
-
getBatchStatus(request: SentinelBatchStatusRequest): Promise<SentinelBatchStatusResponse>;
|
|
144
101
|
}
|
|
145
102
|
//# sourceMappingURL=sentinel-api-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentinel-api-service.d.ts","sourceRoot":"","sources":["../src/sentinel-api-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,KAAK,EAAE,GAAG,EAAQ,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAYL,WAAW,EACZ,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"sentinel-api-service.d.ts","sourceRoot":"","sources":["../src/sentinel-api-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,KAAK,EAAE,GAAG,EAAQ,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAYL,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAcxB,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EACzB,eAAe,EACf,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC3B,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,EAC/B,gCAAgC,EACjC,MAAM,YAAY,CAAC;AAYpB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,kBAAmB,SAAQ,eAAe,CACrD,OAAO,WAAW,EAClB,2BAA2B,CAC5B;;IASC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YAAY,EACV,SAAS,EACT,KAAK,EAAE,aAAgC,EACvC,WAAiC,EACjC,QAAQ,EACR,aAAa,EACb,iBAAsB,EACtB,aAAkB,GACnB,EAAE,yBAAyB,EA+B3B;IAED;;;;;;;;OAQG;IACG,UAAU,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC,CA0CvD;IAED;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAoCpD;IAED;;;;;;;;;;;;;OAaG;IACG,oBAAoB,CACxB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,yBAAyB,EAClC,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;KAAO,GAC1E,OAAO,CAAC,0BAA0B,CAAC,CA4BrC;IAED;;;;;;OAMG;IACG,sBAAsB,CAC1B,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,2BAA2B,CAAC,CA2BtC;IAED;;;;;;;;OAQG;IACG,mBAAmB,CACvB,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,gCAAgC,CAAC,CAsC3C;CA2IF"}
|
|
@@ -4,17 +4,13 @@ import { validate } from '@metamask/superstruct';
|
|
|
4
4
|
import { BASE_URL_TEMPLATE, DEFAULT_ENVIRONMENT, ENDPOINT_NETWORK, ENDPOINT_NETWORKS, ENDPOINT_SMART_TRANSACTIONS, ENVIRONMENT_DOMAIN, NETWORK_STALE_TIME_MS, NETWORKS_STALE_TIME_MS, NETWORKS_SUBDOMAIN, RPC_METHOD_SEND_RELAY, RPC_METHOD_SIMULATE, serviceName, } from './constants.js';
|
|
5
5
|
import { SentinelApiResponseValidationError, SentinelChainNotSupportedError, SentinelJsonRpcError, } from './errors.js';
|
|
6
6
|
import { projectLogger, createModuleLogger } from './logger.js';
|
|
7
|
-
import { SentinelSmartTransactionResponseStruct,
|
|
7
|
+
import { SentinelSmartTransactionResponseStruct, SentinelNetworkRegistryStruct, SentinelNetworkStruct, SentinelRelaySubmitResponseStruct, SentinelSimulationResponseStruct, } from './structs.js';
|
|
8
8
|
const log = createModuleLogger(projectLogger, serviceName);
|
|
9
9
|
const MESSENGER_EXPOSED_METHODS = [
|
|
10
|
-
'cancel',
|
|
11
|
-
'getBatchStatus',
|
|
12
|
-
'getFees',
|
|
13
10
|
'getNetwork',
|
|
14
11
|
'getNetworks',
|
|
15
12
|
'simulateTransactions',
|
|
16
13
|
'submitRelayTransaction',
|
|
17
|
-
'submitTransactions',
|
|
18
14
|
'getSmartTransaction',
|
|
19
15
|
];
|
|
20
16
|
/**
|
|
@@ -33,14 +29,6 @@ const MESSENGER_EXPOSED_METHODS = [
|
|
|
33
29
|
* submission (`eth_sendRelayTransaction`), used by the extension and mobile.
|
|
34
30
|
* - {@link SentinelApiService.getSmartTransaction} — smart-transaction status
|
|
35
31
|
* lookup (`/smart-transactions/{uuid}`).
|
|
36
|
-
* - {@link SentinelApiService.getFees} — smart-transaction fee quotes
|
|
37
|
-
* (`POST /v1/networks/{chainId}/getFees`). Not cached.
|
|
38
|
-
* - {@link SentinelApiService.submitTransactions} — signed smart-transaction
|
|
39
|
-
* submission (`POST /v1/networks/{chainId}/submitTransactions`). Not cached.
|
|
40
|
-
* - {@link SentinelApiService.cancel} — smart-transaction cancellation
|
|
41
|
-
* (`POST /v1/networks/{chainId}/cancel`). Not cached.
|
|
42
|
-
* - {@link SentinelApiService.getBatchStatus} — smart-transaction status lookup
|
|
43
|
-
* for several UUIDs (`GET /v1/networks/{chainId}/batchStatus`). Not cached.
|
|
44
32
|
*
|
|
45
33
|
* Consumers derive higher-level concerns (whether a chain supports simulation
|
|
46
34
|
* or relay, polling loops, etc.) from the raw endpoint responses.
|
|
@@ -255,187 +243,6 @@ export class SentinelApiService extends BaseDataService {
|
|
|
255
243
|
});
|
|
256
244
|
return result;
|
|
257
245
|
}
|
|
258
|
-
/**
|
|
259
|
-
* Quotes gas fees for unsigned smart transactions via
|
|
260
|
-
* `POST /v1/networks/{chainId}/getFees`. Not cached, since a quote goes
|
|
261
|
-
* stale immediately.
|
|
262
|
-
*
|
|
263
|
-
* @param request - The fee quote request.
|
|
264
|
-
* @returns The fee quote response. One entry in `txs` per transaction, in
|
|
265
|
-
* request order.
|
|
266
|
-
*/
|
|
267
|
-
async getFees(request) {
|
|
268
|
-
const { chainId, transactions } = request;
|
|
269
|
-
const baseUrl = await this.#resolveUrl(chainId, 'confirmations');
|
|
270
|
-
const chainIdDecimal = BigInt(chainId).toString(10);
|
|
271
|
-
const url = `${baseUrl}v1/networks/${chainIdDecimal}/getFees`;
|
|
272
|
-
const result = await this.fetchQuery({
|
|
273
|
-
queryKey: [`${this.name}:getFees`, request],
|
|
274
|
-
staleTime: 0,
|
|
275
|
-
queryFn: async () => {
|
|
276
|
-
const headers = await this.#getHeaders();
|
|
277
|
-
log('getFees', 'Request', url, request);
|
|
278
|
-
const response = await this.#fetch(url, {
|
|
279
|
-
method: 'POST',
|
|
280
|
-
headers: {
|
|
281
|
-
...headers,
|
|
282
|
-
'Content-Type': 'application/json',
|
|
283
|
-
},
|
|
284
|
-
body: JSON.stringify({ txs: transactions }),
|
|
285
|
-
});
|
|
286
|
-
if (!response.ok) {
|
|
287
|
-
const data = await readJsonBody(response);
|
|
288
|
-
const error = new HttpError(response.status, `Sentinel API: getFees request failed with status '${response.status}'`);
|
|
289
|
-
if (data !== undefined) {
|
|
290
|
-
Object.assign(error, { data });
|
|
291
|
-
}
|
|
292
|
-
throw error;
|
|
293
|
-
}
|
|
294
|
-
const json = (await response.json());
|
|
295
|
-
const [error] = validate(json, SentinelGetFeesResponseStruct);
|
|
296
|
-
if (error) {
|
|
297
|
-
throw new SentinelApiResponseValidationError(`Sentinel API: Malformed response from /getFees endpoint: ${error.message}`);
|
|
298
|
-
}
|
|
299
|
-
log('getFees', 'Response', json);
|
|
300
|
-
return json;
|
|
301
|
-
},
|
|
302
|
-
});
|
|
303
|
-
return result;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Submits signed smart transactions via
|
|
307
|
-
* `POST /v1/networks/{chainId}/submitTransactions`. Not cached.
|
|
308
|
-
*
|
|
309
|
-
* @param request - The submit request.
|
|
310
|
-
* @returns The UUID assigned to the submitted batch.
|
|
311
|
-
*/
|
|
312
|
-
async submitTransactions(request) {
|
|
313
|
-
const { chainId, rawTxs, rawCancelTxs, rawTxsWithMetadata } = request;
|
|
314
|
-
const baseUrl = await this.#resolveUrl(chainId, 'confirmations');
|
|
315
|
-
const chainIdDecimal = BigInt(chainId).toString(10);
|
|
316
|
-
const url = `${baseUrl}v1/networks/${chainIdDecimal}/submitTransactions`;
|
|
317
|
-
const result = await this.fetchQuery({
|
|
318
|
-
queryKey: [`${this.name}:submitTransactions`, request],
|
|
319
|
-
staleTime: 0,
|
|
320
|
-
queryFn: async () => {
|
|
321
|
-
const headers = await this.#getHeaders();
|
|
322
|
-
log('submitTransactions', 'Request', url, request);
|
|
323
|
-
const response = await this.#fetch(url, {
|
|
324
|
-
method: 'POST',
|
|
325
|
-
headers: {
|
|
326
|
-
...headers,
|
|
327
|
-
'Content-Type': 'application/json',
|
|
328
|
-
},
|
|
329
|
-
body: JSON.stringify({
|
|
330
|
-
rawTxs,
|
|
331
|
-
...(rawCancelTxs === undefined ? {} : { rawCancelTxs }),
|
|
332
|
-
...(rawTxsWithMetadata === undefined ? {} : { rawTxsWithMetadata }),
|
|
333
|
-
}),
|
|
334
|
-
});
|
|
335
|
-
if (!response.ok) {
|
|
336
|
-
const data = await readJsonBody(response);
|
|
337
|
-
const error = new HttpError(response.status, `Sentinel API: submitTransactions request failed with status '${response.status}'`);
|
|
338
|
-
if (data !== undefined) {
|
|
339
|
-
Object.assign(error, { data });
|
|
340
|
-
}
|
|
341
|
-
throw error;
|
|
342
|
-
}
|
|
343
|
-
const json = (await response.json());
|
|
344
|
-
const [error] = validate(json, SentinelSubmitTransactionsResponseStruct);
|
|
345
|
-
if (error) {
|
|
346
|
-
throw new SentinelApiResponseValidationError(`Sentinel API: Malformed response from /submitTransactions endpoint: ${error.message}`);
|
|
347
|
-
}
|
|
348
|
-
log('submitTransactions', 'Response', json);
|
|
349
|
-
return json;
|
|
350
|
-
},
|
|
351
|
-
});
|
|
352
|
-
return result;
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* Cancels a smart transaction via `POST /v1/networks/{chainId}/cancel`.
|
|
356
|
-
* Not cached.
|
|
357
|
-
*
|
|
358
|
-
* @param request - The cancel request.
|
|
359
|
-
* @returns The cancel result. `cancelled` is `true` on success.
|
|
360
|
-
*/
|
|
361
|
-
async cancel(request) {
|
|
362
|
-
const { chainId, uuid } = request;
|
|
363
|
-
const baseUrl = await this.#resolveUrl(chainId, 'confirmations');
|
|
364
|
-
const chainIdDecimal = BigInt(chainId).toString(10);
|
|
365
|
-
const url = `${baseUrl}v1/networks/${chainIdDecimal}/cancel`;
|
|
366
|
-
const result = await this.fetchQuery({
|
|
367
|
-
queryKey: [`${this.name}:cancel`, request],
|
|
368
|
-
staleTime: 0,
|
|
369
|
-
queryFn: async () => {
|
|
370
|
-
const headers = await this.#getHeaders();
|
|
371
|
-
log('cancel', 'Request', url, request);
|
|
372
|
-
const response = await this.#fetch(url, {
|
|
373
|
-
method: 'POST',
|
|
374
|
-
headers: {
|
|
375
|
-
...headers,
|
|
376
|
-
'Content-Type': 'application/json',
|
|
377
|
-
},
|
|
378
|
-
body: JSON.stringify({ uuid }),
|
|
379
|
-
});
|
|
380
|
-
if (!response.ok) {
|
|
381
|
-
const data = await readJsonBody(response);
|
|
382
|
-
const error = new HttpError(response.status, `Sentinel API: Cancel request failed with status '${response.status}'`);
|
|
383
|
-
if (data !== undefined) {
|
|
384
|
-
Object.assign(error, { data });
|
|
385
|
-
}
|
|
386
|
-
throw error;
|
|
387
|
-
}
|
|
388
|
-
const json = (await response.json());
|
|
389
|
-
const [error] = validate(json, SentinelCancelResponseStruct);
|
|
390
|
-
if (error) {
|
|
391
|
-
throw new SentinelApiResponseValidationError(`Sentinel API: Malformed response from /cancel endpoint: ${error.message}`);
|
|
392
|
-
}
|
|
393
|
-
log('cancel', 'Response', json);
|
|
394
|
-
return json;
|
|
395
|
-
},
|
|
396
|
-
});
|
|
397
|
-
return result;
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* Looks up the statuses of several smart transactions via
|
|
401
|
-
* `GET /v1/networks/{chainId}/batchStatus`. Not cached, since statuses change
|
|
402
|
-
* while transactions are pending.
|
|
403
|
-
*
|
|
404
|
-
* @param request - The batch status request.
|
|
405
|
-
* @returns The status of each requested transaction, keyed by UUID.
|
|
406
|
-
*/
|
|
407
|
-
async getBatchStatus(request) {
|
|
408
|
-
const { chainId, uuids } = request;
|
|
409
|
-
const baseUrl = await this.#resolveUrl(chainId, 'confirmations');
|
|
410
|
-
const chainIdDecimal = BigInt(chainId).toString(10);
|
|
411
|
-
const query = new URLSearchParams({ uuids: uuids.join(',') });
|
|
412
|
-
const url = `${baseUrl}v1/networks/${chainIdDecimal}/batchStatus?${query.toString()}`;
|
|
413
|
-
const result = await this.fetchQuery({
|
|
414
|
-
queryKey: [`${this.name}:getBatchStatus`, request],
|
|
415
|
-
staleTime: 0,
|
|
416
|
-
queryFn: async () => {
|
|
417
|
-
const headers = await this.#getHeaders();
|
|
418
|
-
log('getBatchStatus', 'Request', url, request);
|
|
419
|
-
const response = await this.#fetch(url, { headers });
|
|
420
|
-
if (!response.ok) {
|
|
421
|
-
const data = await readJsonBody(response);
|
|
422
|
-
const error = new HttpError(response.status, `Sentinel API: Batch status request failed with status '${response.status}'`);
|
|
423
|
-
if (data !== undefined) {
|
|
424
|
-
Object.assign(error, { data });
|
|
425
|
-
}
|
|
426
|
-
throw error;
|
|
427
|
-
}
|
|
428
|
-
const json = (await response.json());
|
|
429
|
-
const [error] = validate(json, SentinelBatchStatusResponseStruct);
|
|
430
|
-
if (error) {
|
|
431
|
-
throw new SentinelApiResponseValidationError(`Sentinel API: Malformed response from /batchStatus endpoint: ${error.message}`);
|
|
432
|
-
}
|
|
433
|
-
log('getBatchStatus', 'Response', json);
|
|
434
|
-
return json;
|
|
435
|
-
},
|
|
436
|
-
});
|
|
437
|
-
return result;
|
|
438
|
-
}
|
|
439
246
|
/**
|
|
440
247
|
* Performs a JSON-RPC POST to the Sentinel API and returns the `result`.
|
|
441
248
|
*
|
|
@@ -535,19 +342,4 @@ export class SentinelApiService extends BaseDataService {
|
|
|
535
342
|
return BASE_URL_TEMPLATE.replace('{0}', subdomain).replace('{1}', this.#environmentDomain);
|
|
536
343
|
}
|
|
537
344
|
}
|
|
538
|
-
/**
|
|
539
|
-
* Reads a response body as JSON. Returns undefined when the body is empty or
|
|
540
|
-
* not JSON, so a failed request can still surface its HTTP status.
|
|
541
|
-
*
|
|
542
|
-
* @param response - The response to read.
|
|
543
|
-
* @returns The parsed JSON body, or undefined.
|
|
544
|
-
*/
|
|
545
|
-
async function readJsonBody(response) {
|
|
546
|
-
try {
|
|
547
|
-
return (await response.json());
|
|
548
|
-
}
|
|
549
|
-
catch {
|
|
550
|
-
return undefined;
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
345
|
//# sourceMappingURL=sentinel-api-service.js.map
|