@metamask-previews/sentinel-api-service 2.2.0-preview-df8dca72c → 2.2.0-preview-1204f31c1
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 +6 -0
- package/dist/constants.d.ts +3 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +3 -3
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +2 -2
- 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 +4 -2
- 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 +10 -6
- package/dist/sentinel-api-service.d.ts.map +1 -1
- package/dist/sentinel-api-service.js +76 -6
- package/dist/sentinel-api-service.js.map +1 -1
- package/dist/types.d.ts +46 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,10 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Stop caching `getNetwork` (`staleTime: 0`) so live liveness and killswitch flags from `GET /network` propagate immediately ([#11505](https://github.com/MetaMask/core/pull/11505))
|
|
13
|
+
|
|
10
14
|
## [2.2.0]
|
|
11
15
|
|
|
12
16
|
### Added
|
|
13
17
|
|
|
18
|
+
- Add optional `trace` constructor option to `SentinelApiService` for tracing `simulateTransactions`. Tracing is best-effort and does not affect the simulation result if it fails ([#11505](https://github.com/MetaMask/core/pull/11505))
|
|
19
|
+
- Add optional `traceContext` option to `simulateTransactions` to nest the simulation trace under a caller-provided parent context.
|
|
14
20
|
- Add optional `accountHardwareType` to `SentinelMeta` for relay transaction metadata ([#10842](https://github.com/MetaMask/core/pull/10842))
|
|
15
21
|
- 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))
|
|
16
22
|
- `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.
|
package/dist/constants.d.ts
CHANGED
|
@@ -62,10 +62,10 @@ export declare const ENDPOINT_NETWORKS = "networks";
|
|
|
62
62
|
export declare const ENDPOINT_SMART_TRANSACTIONS = "smart-transactions";
|
|
63
63
|
/**
|
|
64
64
|
* How long the single network configuration (`/network`) response is
|
|
65
|
-
* considered fresh.
|
|
66
|
-
*
|
|
65
|
+
* considered fresh. Set to `0` so every request refetches, since the response
|
|
66
|
+
* carries live liveness and killswitch state that must propagate immediately.
|
|
67
67
|
*/
|
|
68
|
-
export declare const NETWORK_STALE_TIME_MS
|
|
68
|
+
export declare const NETWORK_STALE_TIME_MS = 0;
|
|
69
69
|
/**
|
|
70
70
|
* How long the network registry (`/networks`) response is considered fresh.
|
|
71
71
|
* The registry is stable, so caching it avoids re-fetching on every request.
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,WAAW,uBAAuB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,mBAAmB,gCAAgC,CAAC;AAEjE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,6BAA6B,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,gDAAgD,CAAC;AAE/E;;;GAGG;AACH,oBAAY,mBAAmB;IAC7B,0DAA0D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AE5C;;;GAGG;AACH,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAAgB,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -67,10 +67,10 @@ export const ENDPOINT_NETWORKS = 'networks';
|
|
|
67
67
|
export const ENDPOINT_SMART_TRANSACTIONS = 'smart-transactions';
|
|
68
68
|
/**
|
|
69
69
|
* How long the single network configuration (`/network`) response is
|
|
70
|
-
* considered fresh.
|
|
71
|
-
*
|
|
70
|
+
* considered fresh. Set to `0` so every request refetches, since the response
|
|
71
|
+
* carries live liveness and killswitch state that must propagate immediately.
|
|
72
72
|
*/
|
|
73
|
-
export const NETWORK_STALE_TIME_MS =
|
|
73
|
+
export const NETWORK_STALE_TIME_MS = 0;
|
|
74
74
|
/**
|
|
75
75
|
* How long the network registry (`/networks`) response is considered fresh.
|
|
76
76
|
* The registry is stable, so caching it avoids re-fetching on every request.
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,6BAA6B,CAAC;AAEjE;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,0BAA0B,CAAC;AAEhE;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,6CAA6C,CAAC;AAE/E;;;GAGG;AACH,MAAM,CAAN,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,0DAA0D;IAC1D,kCAAW,CAAA;IACX,sEAAsE;IACtE,kCAAW,CAAA;IACX,qDAAqD;IACrD,oCAAa,CAAA;AACf,CAAC,EAPW,mBAAmB,KAAnB,mBAAm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IACrE,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,SAAS;IACpC,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,SAAS;IACpC,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,KAAK;CAClC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,IAAI,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAErD;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,SAAS,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,oBAAoB,CAAC;AAEhE;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC","sourcesContent":["/**\n * The name of the {@link SentinelApiService}, used to namespace the service's\n * actions and events.\n */\nexport const serviceName = 'SentinelApiService';\n\n/**\n * JSON-RPC method used to simulate transactions against the Sentinel API.\n */\nexport const RPC_METHOD_SIMULATE = 'infura_simulateTransactions';\n\n/**\n * JSON-RPC method used to submit a signed relay (gas station) transaction to\n * the Sentinel API.\n */\nexport const RPC_METHOD_SEND_RELAY = 'eth_sendRelayTransaction';\n\n/**\n * Template for the Sentinel API base URL. `{0}` is replaced with the network\n * subdomain (for example `ethereum-mainnet`) and `{1}` with the environment\n * API-domain segment (see {@link ENVIRONMENT_DOMAIN}).\n */\nexport const BASE_URL_TEMPLATE = 'https://tx-sentinel-{0}.{1}.cx.metamask.io/';\n\n/**\n * The Sentinel API environments. Each maps to a distinct API domain segment;\n * see {@link ENVIRONMENT_DOMAIN}.\n */\nexport enum SentinelEnvironment {\n /** Development environment (`dev-api.cx.metamask.io`). */\n Dev = 'dev',\n /** User-acceptance-testing environment (`uat-api.cx.metamask.io`). */\n Uat = 'uat',\n /** Production environment (`api.cx.metamask.io`). */\n Prod = 'prod',\n}\n\n/**\n * Maps a {@link SentinelEnvironment} to the API-domain segment substituted into\n * {@link BASE_URL_TEMPLATE} (the `{1}` placeholder).\n */\nexport const ENVIRONMENT_DOMAIN: Record<SentinelEnvironment, string> = {\n [SentinelEnvironment.Dev]: 'dev-api',\n [SentinelEnvironment.Uat]: 'uat-api',\n [SentinelEnvironment.Prod]: 'api',\n};\n\n/**\n * The default {@link SentinelEnvironment} used when the constructor does not\n * specify one. Production, matching the behaviour of the clients this service\n * replaces.\n */\nexport const DEFAULT_ENVIRONMENT = SentinelEnvironment.Prod;\n\n/**\n * The subdomain used for network-registry lookups. The `/networks` endpoint\n * returns identical data regardless of subdomain, so a stable one is used.\n */\nexport const NETWORKS_SUBDOMAIN = 'ethereum-mainnet';\n\n/**\n * The REST path used to retrieve the configuration of a single network. Must\n * be requested against the subdomain of the network in question.\n */\nexport const ENDPOINT_NETWORK = 'network';\n\n/**\n * The REST path used to retrieve the supported-network registry.\n */\nexport const ENDPOINT_NETWORKS = 'networks';\n\n/**\n * The REST path prefix used to poll the status of a submitted smart\n * transaction by UUID.\n */\nexport const ENDPOINT_SMART_TRANSACTIONS = 'smart-transactions';\n\n/**\n * How long the single network configuration (`/network`) response is\n * considered fresh. Set to `0` so every request refetches, since the response\n * carries live liveness and killswitch state that must propagate immediately.\n */\nexport const NETWORK_STALE_TIME_MS = 0;\n\n/**\n * How long the network registry (`/networks`) response is considered fresh.\n * The registry is stable, so caching it avoids re-fetching on every request.\n */\nexport const NETWORKS_STALE_TIME_MS = 5 * 60 * 1000;\n"]}
|
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, SentinelBatchedTransactionStatus, SentinelBatchStatusRequest, SentinelBatchStatusResponse, SentinelCancelRequest, SentinelCancelResponse, SentinelGetFeesRequest, SentinelGetFeesResponse, SentinelMeta, SentinelNetwork, SentinelNetworkRegistry, SentinelRelaySubmitRequest, SentinelRelaySubmitResponse, SentinelSignedAuthorization, SentinelSimulationCallTrace, SentinelSimulationLog, SentinelSimulationRequest, SentinelSimulationResponse, SentinelSimulationResponseTransaction, SentinelSimulationStateDiff, SentinelSimulationTokenFee, SentinelSimulationTransaction, SentinelSmartTransaction, SentinelSmartTransactionFee, SentinelSmartTransactionFees, SentinelSmartTransactionRequest, SentinelSmartTransactionResponse, SentinelStateOverrides, SentinelSubmitTransactionsRequest, SentinelSubmitTransactionsResponse, SentinelSubmitTransactionWithMetadata, } from './types.js';
|
|
4
|
-
export { SentinelCancellationReason, SentinelFeature, SentinelKind, SentinelMinedTxStatus, SentinelOriginalTransactionStatus, SentinelProductFeature, SentinelSmartTransactionStatus, } from './types.js';
|
|
3
|
+
export type { SentinelApiServiceActions, SentinelApiServiceEvents, SentinelApiServiceMessenger, SentinelApiServiceOptions, SentinelApiServiceInvalidateQueriesAction, SentinelApiServiceCacheUpdatedEvent, SentinelApiServiceGranularCacheUpdatedEvent, SentinelApiServiceTraceCallback, SentinelApiServiceTraceName, SentinelApiServiceTraceOptions, SentinelApiServiceTraceRequest, SentinelAuthorization, SentinelBatchedTransactionStatus, SentinelBatchStatusRequest, SentinelBatchStatusResponse, SentinelCancelRequest, SentinelCancelResponse, SentinelGetFeesRequest, SentinelGetFeesResponse, SentinelMeta, SentinelNetwork, SentinelNetworkRegistry, SentinelRelaySubmitRequest, SentinelRelaySubmitResponse, SentinelSignedAuthorization, SentinelSimulationCallTrace, SentinelSimulationLog, SentinelSimulationRequest, SentinelSimulationResponse, SentinelSimulationResponseTransaction, SentinelSimulationStateDiff, SentinelSimulationTokenFee, SentinelSimulationTransaction, SentinelSmartTransaction, SentinelSmartTransactionFee, SentinelSmartTransactionFees, SentinelSmartTransactionRequest, SentinelSmartTransactionResponse, SentinelStateOverrides, SentinelSubmitTransactionsRequest, SentinelSubmitTransactionsResponse, SentinelSubmitTransactionWithMetadata, } from './types.js';
|
|
4
|
+
export { SentinelCancellationReason, SentinelFeature, SentinelKind, SentinelMinedTxStatus, SentinelOriginalTransactionStatus, SentinelProductFeature, SentinelSmartTransactionStatus, TRACES, } from './types.js';
|
|
5
5
|
export type { SentinelApiServiceGetFeesAction, SentinelApiServiceGetNetworkAction, SentinelApiServiceGetNetworksAction, SentinelApiServiceSimulateTransactionsAction, SentinelApiServiceSubmitRelayTransactionAction, SentinelApiServiceSubmitTransactionsAction, SentinelApiServiceGetSmartTransactionAction, SentinelApiServiceCancelAction, SentinelApiServiceGetBatchStatusAction, } 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,gCAAgC,EAChC,0BAA0B,EAC1B,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,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,EAChC,sBAAsB,EACtB,iCAAiC,EACjC,kCAAkC,EAClC,qCAAqC,GACtC,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,0BAA0B,EAC1B,eAAe,EACf,YAAY,EACZ,qBAAqB,EACrB,iCAAiC,EACjC,sBAAsB,EACtB,8BAA8B,EAC9B,MAAM,GACP,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,+BAA+B,EAC/B,kCAAkC,EAClC,mCAAmC,EACnC,4CAA4C,EAC5C,8CAA8C,EAC9C,0CAA0C,EAC1C,2CAA2C,EAC3C,8BAA8B,EAC9B,sCAAsC,GACvC,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 { SentinelCancellationReason, SentinelFeature, SentinelKind, SentinelMinedTxStatus, SentinelOriginalTransactionStatus, SentinelProductFeature, SentinelSmartTransactionStatus, } from './types.js';
|
|
3
|
+
export { SentinelCancellationReason, SentinelFeature, SentinelKind, SentinelMinedTxStatus, SentinelOriginalTransactionStatus, SentinelProductFeature, SentinelSmartTransactionStatus, TRACES, } 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;AA6ClE,OAAO,EACL,0BAA0B,EAC1B,eAAe,EACf,YAAY,EACZ,qBAAqB,EACrB,iCAAiC,EACjC,sBAAsB,EACtB,8BAA8B,EAC9B,MAAM,GACP,MAAM,YAAY,CAAC;AAYpB,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 SentinelApiServiceTraceCallback,\n SentinelApiServiceTraceName,\n SentinelApiServiceTraceOptions,\n SentinelApiServiceTraceRequest,\n SentinelAuthorization,\n SentinelBatchedTransactionStatus,\n SentinelBatchStatusRequest,\n SentinelBatchStatusResponse,\n SentinelCancelRequest,\n SentinelCancelResponse,\n SentinelGetFeesRequest,\n SentinelGetFeesResponse,\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 SentinelSmartTransactionFee,\n SentinelSmartTransactionFees,\n SentinelSmartTransactionRequest,\n SentinelSmartTransactionResponse,\n SentinelStateOverrides,\n SentinelSubmitTransactionsRequest,\n SentinelSubmitTransactionsResponse,\n SentinelSubmitTransactionWithMetadata,\n} from './types.js';\nexport {\n SentinelCancellationReason,\n SentinelFeature,\n SentinelKind,\n SentinelMinedTxStatus,\n SentinelOriginalTransactionStatus,\n SentinelProductFeature,\n SentinelSmartTransactionStatus,\n TRACES,\n} from './types.js';\nexport type {\n SentinelApiServiceGetFeesAction,\n SentinelApiServiceGetNetworkAction,\n SentinelApiServiceGetNetworksAction,\n SentinelApiServiceSimulateTransactionsAction,\n SentinelApiServiceSubmitRelayTransactionAction,\n SentinelApiServiceSubmitTransactionsAction,\n SentinelApiServiceGetSmartTransactionAction,\n SentinelApiServiceCancelAction,\n SentinelApiServiceGetBatchStatusAction,\n} from './sentinel-api-service-method-action-types.js';\nexport {\n SentinelApiResponseValidationError,\n SentinelChainNotSupportedError,\n SentinelJsonRpcError,\n} from './errors.js';\n"]}
|
|
@@ -6,8 +6,7 @@ import type { SentinelApiService } from './sentinel-api-service.js';
|
|
|
6
6
|
/**
|
|
7
7
|
* Fetches the configuration of a single network from the `/network`
|
|
8
8
|
* endpoint of that network's subdomain. The subdomain is resolved from the
|
|
9
|
-
* supported-network registry.
|
|
10
|
-
* stable.
|
|
9
|
+
* supported-network registry. Not cached as it is the sentinel live capabilities endpoint.
|
|
11
10
|
*
|
|
12
11
|
* @param chainId - The chain ID of the network.
|
|
13
12
|
* @returns The network configuration.
|
|
@@ -38,6 +37,9 @@ export type SentinelApiServiceGetNetworksAction = {
|
|
|
38
37
|
* Sentinel URL resolved for the chain and returns the URL to use instead.
|
|
39
38
|
* Lets consumers rewrite the request URL (for example to route through the
|
|
40
39
|
* MetaMask Shield proxy) without the service knowing about those concerns.
|
|
40
|
+
* @param options.traceContext - Optional trace context to nest the
|
|
41
|
+
* simulation trace under. Without it, clients that do not infer a parent
|
|
42
|
+
* from the active span record the trace as a root span.
|
|
41
43
|
* @returns The simulation response.
|
|
42
44
|
*/
|
|
43
45
|
export type SentinelApiServiceSimulateTransactionsAction = {
|
|
@@ -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
|
|
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;;;;;;;GAOG;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;;;;;;;;;;;;;;;;GAgBG;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;;;;;;;;GAQG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,uCAAuC,CAAC;IAC9C,OAAO,EAAE,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;CACnD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,2BAA2B,CAAC;IAClC,OAAO,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;CACvC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,+BAA+B,GACvC,kCAAkC,GAClC,mCAAmC,GACnC,4CAA4C,GAC5C,8CAA8C,GAC9C,2CAA2C,GAC3C,+BAA+B,GAC/B,0CAA0C,GAC1C,8BAA8B,GAC9B,sCAAsC,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.
|
|
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. Not cached as it is the sentinel live capabilities endpoint.\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 * @param options.traceContext - Optional trace context to nest the\n * simulation trace under. Without it, clients that do not infer a parent\n * from the active span record the trace as a root span.\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 * Quotes gas fees for unsigned smart transactions via\n * `POST /v1/networks/{chainId}/getFees`. Not cached, since a quote goes\n * stale immediately.\n *\n * @param request - The fee quote request.\n * @returns The fee quote response. One entry in `txs` per transaction, in\n * request order.\n */\nexport type SentinelApiServiceGetFeesAction = {\n type: `SentinelApiService:getFees`;\n handler: SentinelApiService['getFees'];\n};\n\n/**\n * Submits signed smart transactions via\n * `POST /v1/networks/{chainId}/submitTransactions`. Not cached.\n *\n * @param request - The submit request.\n * @returns The UUID assigned to the submitted batch.\n */\nexport type SentinelApiServiceSubmitTransactionsAction = {\n type: `SentinelApiService:submitTransactions`;\n handler: SentinelApiService['submitTransactions'];\n};\n\n/**\n * Cancels a smart transaction via `POST /v1/networks/{chainId}/cancel`.\n * Not cached.\n *\n * @param request - The cancel request.\n * @returns The cancel result. `cancelled` is `true` on success.\n */\nexport type SentinelApiServiceCancelAction = {\n type: `SentinelApiService:cancel`;\n handler: SentinelApiService['cancel'];\n};\n\n/**\n * Looks up the statuses of several smart transactions via\n * `GET /v1/networks/{chainId}/batchStatus`. Not cached, since statuses change\n * while transactions are pending.\n *\n * @param request - The batch status request.\n * @returns The status of each requested transaction, keyed by UUID.\n */\nexport type SentinelApiServiceGetBatchStatusAction = {\n type: `SentinelApiService:getBatchStatus`;\n handler: SentinelApiService['getBatchStatus'];\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 | SentinelApiServiceGetFeesAction\n | SentinelApiServiceSubmitTransactionsAction\n | SentinelApiServiceCancelAction\n | SentinelApiServiceGetBatchStatusAction;\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
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, SentinelBatchStatusRequest, SentinelBatchStatusResponse, SentinelCancelRequest, SentinelCancelResponse, SentinelGetFeesRequest, SentinelGetFeesResponse, SentinelNetwork, SentinelNetworkRegistry, SentinelRelaySubmitRequest, SentinelRelaySubmitResponse, SentinelSimulationRequest, SentinelSimulationResponse, SentinelSmartTransactionRequest, SentinelSmartTransactionResponse, SentinelSubmitTransactionsRequest, SentinelSubmitTransactionsResponse } from './types.js';
|
|
4
|
+
import type { SentinelApiServiceMessenger, SentinelApiServiceOptions, SentinelApiServiceTraceOptions, SentinelBatchStatusRequest, SentinelBatchStatusResponse, SentinelCancelRequest, SentinelCancelResponse, SentinelGetFeesRequest, SentinelGetFeesResponse, SentinelNetwork, SentinelNetworkRegistry, SentinelRelaySubmitRequest, SentinelRelaySubmitResponse, SentinelSimulationRequest, SentinelSimulationResponse, SentinelSmartTransactionRequest, SentinelSmartTransactionResponse, SentinelSubmitTransactionsRequest, SentinelSubmitTransactionsResponse } 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`).
|
|
8
8
|
*
|
|
9
9
|
* It exposes one method per Sentinel endpoint:
|
|
10
10
|
* - {@link SentinelApiService.getNetwork} — the configuration of a single
|
|
11
|
-
* network (`/network`)
|
|
11
|
+
* network (`/network`). Not cached since it is the sentinel live capabilities endpoint.
|
|
12
12
|
* - {@link SentinelApiService.getNetworks} — the supported-network registry
|
|
13
13
|
* (`/networks`), cached since it is stable and identical across subdomains.
|
|
14
14
|
* - {@link SentinelApiService.simulateTransactions} — transaction simulation
|
|
@@ -52,13 +52,14 @@ export declare class SentinelApiService extends BaseDataService<typeof serviceNa
|
|
|
52
52
|
* Retries are disabled by default (`maxRetries: 0`) to preserve the
|
|
53
53
|
* single-attempt behaviour of the clients this service replaces; pass
|
|
54
54
|
* `maxRetries` here to opt in.
|
|
55
|
+
* @param options.trace - Optional callback to trace network requests.
|
|
56
|
+
* Tracing is best-effort and does not affect the request result if it fails.
|
|
55
57
|
*/
|
|
56
|
-
constructor({ messenger, fetch: fetchFunction, environment, clientId, clientVersion, queryClientConfig, policyOptions, }: SentinelApiServiceOptions);
|
|
58
|
+
constructor({ messenger, fetch: fetchFunction, environment, clientId, clientVersion, queryClientConfig, policyOptions, trace, }: SentinelApiServiceOptions);
|
|
57
59
|
/**
|
|
58
60
|
* Fetches the configuration of a single network from the `/network`
|
|
59
61
|
* endpoint of that network's subdomain. The subdomain is resolved from the
|
|
60
|
-
* supported-network registry.
|
|
61
|
-
* stable.
|
|
62
|
+
* supported-network registry. Not cached as it is the sentinel live capabilities endpoint.
|
|
62
63
|
*
|
|
63
64
|
* @param chainId - The chain ID of the network.
|
|
64
65
|
* @returns The network configuration.
|
|
@@ -83,11 +84,14 @@ export declare class SentinelApiService extends BaseDataService<typeof serviceNa
|
|
|
83
84
|
* Sentinel URL resolved for the chain and returns the URL to use instead.
|
|
84
85
|
* Lets consumers rewrite the request URL (for example to route through the
|
|
85
86
|
* MetaMask Shield proxy) without the service knowing about those concerns.
|
|
87
|
+
* @param options.traceContext - Optional trace context to nest the
|
|
88
|
+
* simulation trace under. Without it, clients that do not infer a parent
|
|
89
|
+
* from the active span record the trace as a root span.
|
|
86
90
|
* @returns The simulation response.
|
|
87
91
|
*/
|
|
88
92
|
simulateTransactions(chainId: Hex, request: SentinelSimulationRequest, options?: {
|
|
89
93
|
getUrl?: (defaultUrl: string) => string | Promise<string>;
|
|
90
|
-
}): Promise<SentinelSimulationResponse>;
|
|
94
|
+
} & SentinelApiServiceTraceOptions): Promise<SentinelSimulationResponse>;
|
|
91
95
|
/**
|
|
92
96
|
* Submits a signed relay (gas station) transaction to the Sentinel API via
|
|
93
97
|
* `eth_sendRelayTransaction`. Not cached.
|
|
@@ -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;
|
|
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;AAI9D,OAAO,KAAK,EAAE,GAAG,EAAQ,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAYL,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAkBxB,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EAEzB,8BAA8B,EAE9B,0BAA0B,EAC1B,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC3B,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,EAC/B,gCAAgC,EAChC,iCAAiC,EACjC,kCAAkC,EACnC,MAAM,YAAY,CAAC;AAkBpB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,kBAAmB,SAAQ,eAAe,CACrD,OAAO,WAAW,EAClB,2BAA2B,CAC5B;;IAWC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,YAAY,EACV,SAAS,EACT,KAAK,EAAE,aAAgC,EACvC,WAAiC,EACjC,QAAQ,EACR,aAAa,EACb,iBAAsB,EACtB,aAAkB,EAClB,KAAK,GACN,EAAE,yBAAyB,EAgC3B;IAED;;;;;;;OAOG;IACG,UAAU,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC,CA0CvD;IAED;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAoCpD;IAmDD;;;;;;;;;;;;;;;;OAgBG;IACG,oBAAoB,CACxB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,yBAAyB,EAClC,OAAO,GAAE;QACP,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;KAC3D,GAAG,8BAAmC,GACtC,OAAO,CAAC,0BAA0B,CAAC,CA0CrC;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;IAED;;;;;;;;OAQG;IACG,OAAO,CACX,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,uBAAuB,CAAC,CAmDlC;IAED;;;;;;OAMG;IACG,kBAAkB,CACtB,OAAO,EAAE,iCAAiC,GACzC,OAAO,CAAC,kCAAkC,CAAC,CA0D7C;IAED;;;;;;OAMG;IACG,MAAM,CACV,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,sBAAsB,CAAC,CAmDjC;IAED;;;;;;;OAOG;IACG,cAAc,CAClB,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,2BAA2B,CAAC,CA6CtC;CA2IF"}
|
|
@@ -5,7 +5,9 @@ import { BASE_URL_TEMPLATE, DEFAULT_ENVIRONMENT, ENDPOINT_NETWORK, ENDPOINT_NETW
|
|
|
5
5
|
import { SentinelApiResponseValidationError, SentinelChainNotSupportedError, SentinelJsonRpcError, } from './errors.js';
|
|
6
6
|
import { projectLogger, createModuleLogger } from './logger.js';
|
|
7
7
|
import { SentinelSmartTransactionResponseStruct, SentinelBatchStatusResponseStruct, SentinelNetworkRegistryStruct, SentinelNetworkStruct, SentinelCancelResponseStruct, SentinelGetFeesResponseStruct, SentinelRelaySubmitResponseStruct, SentinelSimulationResponseStruct, SentinelSubmitTransactionsResponseStruct, } from './structs.js';
|
|
8
|
+
import { TRACES } from './types.js';
|
|
8
9
|
const log = createModuleLogger(projectLogger, serviceName);
|
|
10
|
+
const traceLogger = createModuleLogger(projectLogger, 'trace');
|
|
9
11
|
const MESSENGER_EXPOSED_METHODS = [
|
|
10
12
|
'cancel',
|
|
11
13
|
'getBatchStatus',
|
|
@@ -23,7 +25,7 @@ const MESSENGER_EXPOSED_METHODS = [
|
|
|
23
25
|
*
|
|
24
26
|
* It exposes one method per Sentinel endpoint:
|
|
25
27
|
* - {@link SentinelApiService.getNetwork} — the configuration of a single
|
|
26
|
-
* network (`/network`)
|
|
28
|
+
* network (`/network`). Not cached since it is the sentinel live capabilities endpoint.
|
|
27
29
|
* - {@link SentinelApiService.getNetworks} — the supported-network registry
|
|
28
30
|
* (`/networks`), cached since it is stable and identical across subdomains.
|
|
29
31
|
* - {@link SentinelApiService.simulateTransactions} — transaction simulation
|
|
@@ -50,6 +52,7 @@ export class SentinelApiService extends BaseDataService {
|
|
|
50
52
|
#clientId;
|
|
51
53
|
#clientVersion;
|
|
52
54
|
#environmentDomain;
|
|
55
|
+
#trace;
|
|
53
56
|
/**
|
|
54
57
|
* Constructs a new SentinelApiService.
|
|
55
58
|
*
|
|
@@ -70,8 +73,10 @@ export class SentinelApiService extends BaseDataService {
|
|
|
70
73
|
* Retries are disabled by default (`maxRetries: 0`) to preserve the
|
|
71
74
|
* single-attempt behaviour of the clients this service replaces; pass
|
|
72
75
|
* `maxRetries` here to opt in.
|
|
76
|
+
* @param options.trace - Optional callback to trace network requests.
|
|
77
|
+
* Tracing is best-effort and does not affect the request result if it fails.
|
|
73
78
|
*/
|
|
74
|
-
constructor({ messenger, fetch: fetchFunction = globalThis.fetch, environment = DEFAULT_ENVIRONMENT, clientId, clientVersion, queryClientConfig = {}, policyOptions = {}, }) {
|
|
79
|
+
constructor({ messenger, fetch: fetchFunction = globalThis.fetch, environment = DEFAULT_ENVIRONMENT, clientId, clientVersion, queryClientConfig = {}, policyOptions = {}, trace, }) {
|
|
75
80
|
super({
|
|
76
81
|
name: serviceName,
|
|
77
82
|
messenger,
|
|
@@ -91,14 +96,14 @@ export class SentinelApiService extends BaseDataService {
|
|
|
91
96
|
this.#environmentDomain = ENVIRONMENT_DOMAIN[environment];
|
|
92
97
|
this.#clientId = clientId;
|
|
93
98
|
this.#clientVersion = clientVersion;
|
|
99
|
+
this.#trace = trace ?? noopTrace;
|
|
94
100
|
this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
|
|
95
101
|
log('Initialized');
|
|
96
102
|
}
|
|
97
103
|
/**
|
|
98
104
|
* Fetches the configuration of a single network from the `/network`
|
|
99
105
|
* endpoint of that network's subdomain. The subdomain is resolved from the
|
|
100
|
-
* supported-network registry.
|
|
101
|
-
* stable.
|
|
106
|
+
* supported-network registry. Not cached as it is the sentinel live capabilities endpoint.
|
|
102
107
|
*
|
|
103
108
|
* @param chainId - The chain ID of the network.
|
|
104
109
|
* @returns The network configuration.
|
|
@@ -159,6 +164,50 @@ export class SentinelApiService extends BaseDataService {
|
|
|
159
164
|
});
|
|
160
165
|
return result;
|
|
161
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* Runs a request and emits a best-effort backdated trace.
|
|
169
|
+
*
|
|
170
|
+
* @param request - Trace metadata for the request.
|
|
171
|
+
* @param fn - Request to execute.
|
|
172
|
+
* @returns The request result.
|
|
173
|
+
*/
|
|
174
|
+
async #traceRequest(request, fn) {
|
|
175
|
+
const startTime = Date.now();
|
|
176
|
+
let success = false;
|
|
177
|
+
let errorName;
|
|
178
|
+
try {
|
|
179
|
+
const result = await fn();
|
|
180
|
+
success = true;
|
|
181
|
+
return result;
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
errorName = error instanceof Error ? error.name : typeof error;
|
|
185
|
+
throw error;
|
|
186
|
+
}
|
|
187
|
+
finally {
|
|
188
|
+
const traceRequest = {
|
|
189
|
+
...request,
|
|
190
|
+
startTime,
|
|
191
|
+
data: {
|
|
192
|
+
...request.data,
|
|
193
|
+
success,
|
|
194
|
+
...(errorName ? { errorName } : {}),
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
const onTraceError = (traceError) => {
|
|
198
|
+
traceLogger('Failed to emit trace', {
|
|
199
|
+
traceName: request.name,
|
|
200
|
+
traceError,
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
try {
|
|
204
|
+
Promise.resolve(this.#trace(traceRequest, () => undefined)).catch(onTraceError);
|
|
205
|
+
}
|
|
206
|
+
catch (traceError) {
|
|
207
|
+
onTraceError(traceError);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
162
211
|
/**
|
|
163
212
|
* Simulates transactions against the Sentinel API via
|
|
164
213
|
* `infura_simulateTransactions`. Not cached, since each request body is
|
|
@@ -171,6 +220,9 @@ export class SentinelApiService extends BaseDataService {
|
|
|
171
220
|
* Sentinel URL resolved for the chain and returns the URL to use instead.
|
|
172
221
|
* Lets consumers rewrite the request URL (for example to route through the
|
|
173
222
|
* MetaMask Shield proxy) without the service knowing about those concerns.
|
|
223
|
+
* @param options.traceContext - Optional trace context to nest the
|
|
224
|
+
* simulation trace under. Without it, clients that do not infer a parent
|
|
225
|
+
* from the active span record the trace as a root span.
|
|
174
226
|
* @returns The simulation response.
|
|
175
227
|
*/
|
|
176
228
|
async simulateTransactions(chainId, request, options = {}) {
|
|
@@ -179,7 +231,14 @@ export class SentinelApiService extends BaseDataService {
|
|
|
179
231
|
const result = await this.fetchQuery({
|
|
180
232
|
queryKey: [`${this.name}:simulateTransactions`, chainId, request, url],
|
|
181
233
|
staleTime: 0,
|
|
182
|
-
queryFn:
|
|
234
|
+
queryFn: () => this.#traceRequest({
|
|
235
|
+
name: TRACES.SIMULATE_TRANSACTIONS,
|
|
236
|
+
parentContext: options.traceContext,
|
|
237
|
+
data: {
|
|
238
|
+
chainId,
|
|
239
|
+
transactionCount: request.transactions.length,
|
|
240
|
+
},
|
|
241
|
+
}, async () => {
|
|
183
242
|
log('simulateTransactions', 'Request', url, request);
|
|
184
243
|
const rpcResult = await this.#jsonRpc(url, RPC_METHOD_SIMULATE, [
|
|
185
244
|
request,
|
|
@@ -190,7 +249,7 @@ export class SentinelApiService extends BaseDataService {
|
|
|
190
249
|
}
|
|
191
250
|
log('simulateTransactions', 'Response', rpcResult);
|
|
192
251
|
return rpcResult;
|
|
193
|
-
},
|
|
252
|
+
}),
|
|
194
253
|
});
|
|
195
254
|
return result;
|
|
196
255
|
}
|
|
@@ -550,4 +609,15 @@ async function readJsonBody(response) {
|
|
|
550
609
|
return undefined;
|
|
551
610
|
}
|
|
552
611
|
}
|
|
612
|
+
/**
|
|
613
|
+
* Default trace callback used when the client does not pass one. Records
|
|
614
|
+
* nothing and runs `fn` so the callback contract still holds.
|
|
615
|
+
*
|
|
616
|
+
* @param _request - The trace request, ignored.
|
|
617
|
+
* @param fn - Optional work to run.
|
|
618
|
+
* @returns The value returned by `fn`.
|
|
619
|
+
*/
|
|
620
|
+
async function noopTrace(_request, fn) {
|
|
621
|
+
return await Promise.resolve(fn?.());
|
|
622
|
+
}
|
|
553
623
|
//# sourceMappingURL=sentinel-api-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentinel-api-service.js","sourceRoot":"","sources":["../src/sentinel-api-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,2BAA2B,EAC3B,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,kCAAkC,EAClC,8BAA8B,EAC9B,oBAAoB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AC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAS,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC","sourcesContent":["import { BaseDataService } from '@metamask/base-data-service';\nimport { handleWhen, HttpError } from '@metamask/controller-utils';\nimport { validate } from '@metamask/superstruct';\nimport type { Hex, Json } from '@metamask/utils';\n\nimport {\n BASE_URL_TEMPLATE,\n DEFAULT_ENVIRONMENT,\n ENDPOINT_NETWORK,\n ENDPOINT_NETWORKS,\n ENDPOINT_SMART_TRANSACTIONS,\n ENVIRONMENT_DOMAIN,\n NETWORK_STALE_TIME_MS,\n NETWORKS_STALE_TIME_MS,\n NETWORKS_SUBDOMAIN,\n RPC_METHOD_SEND_RELAY,\n RPC_METHOD_SIMULATE,\n serviceName,\n} from './constants.js';\nimport {\n SentinelApiResponseValidationError,\n SentinelChainNotSupportedError,\n SentinelJsonRpcError,\n} from './errors.js';\nimport { projectLogger, createModuleLogger } from './logger.js';\nimport {\n SentinelSmartTransactionResponseStruct,\n SentinelBatchStatusResponseStruct,\n SentinelNetworkRegistryStruct,\n SentinelNetworkStruct,\n SentinelCancelResponseStruct,\n SentinelGetFeesResponseStruct,\n SentinelRelaySubmitResponseStruct,\n SentinelSimulationResponseStruct,\n SentinelSubmitTransactionsResponseStruct,\n} from './structs.js';\nimport type {\n SentinelApiServiceMessenger,\n SentinelApiServiceOptions,\n SentinelBatchStatusRequest,\n SentinelBatchStatusResponse,\n SentinelCancelRequest,\n SentinelCancelResponse,\n SentinelGetFeesRequest,\n SentinelGetFeesResponse,\n SentinelNetwork,\n SentinelNetworkRegistry,\n SentinelRelaySubmitRequest,\n SentinelRelaySubmitResponse,\n SentinelSimulationRequest,\n SentinelSimulationResponse,\n SentinelSmartTransactionRequest,\n SentinelSmartTransactionResponse,\n SentinelSubmitTransactionsRequest,\n SentinelSubmitTransactionsResponse,\n} from './types.js';\n\nconst log = createModuleLogger(projectLogger, serviceName);\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'cancel',\n 'getBatchStatus',\n 'getFees',\n 'getNetwork',\n 'getNetworks',\n 'simulateTransactions',\n 'submitRelayTransaction',\n 'submitTransactions',\n 'getSmartTransaction',\n] as const;\n\n/**\n * Data service that centralises all interactions with the MetaMask Sentinel\n * API (`tx-sentinel-<network>.api.cx.metamask.io`).\n *\n * It exposes one method per Sentinel endpoint:\n * - {@link SentinelApiService.getNetwork} — the configuration of a single\n * network (`/network`), cached since it is stable.\n * - {@link SentinelApiService.getNetworks} — the supported-network registry\n * (`/networks`), cached since it is stable and identical across subdomains.\n * - {@link SentinelApiService.simulateTransactions} — transaction simulation\n * (`infura_simulateTransactions`), used by `@metamask/transaction-controller`\n * and `@metamask/transaction-pay-controller`.\n * - {@link SentinelApiService.submitRelayTransaction} — gas station relay\n * submission (`eth_sendRelayTransaction`), used by the extension and mobile.\n * - {@link SentinelApiService.getSmartTransaction} — smart-transaction status\n * lookup (`/smart-transactions/{uuid}`).\n * - {@link SentinelApiService.getFees} — smart-transaction fee quotes\n * (`POST /v1/networks/{chainId}/getFees`). Not cached.\n * - {@link SentinelApiService.submitTransactions} — signed smart-transaction\n * submission (`POST /v1/networks/{chainId}/submitTransactions`). Not cached.\n * - {@link SentinelApiService.cancel} — smart-transaction cancellation\n * (`POST /v1/networks/{chainId}/cancel`). Not cached.\n * - {@link SentinelApiService.getBatchStatus} — smart-transaction status lookup\n * for several UUIDs (`GET /v1/networks/{chainId}/batchStatus`). Not cached.\n *\n * Consumers derive higher-level concerns (whether a chain supports simulation\n * or relay, polling loops, etc.) from the raw endpoint responses.\n */\nexport class SentinelApiService extends BaseDataService<\n typeof serviceName,\n SentinelApiServiceMessenger\n> {\n readonly #fetch: typeof fetch;\n\n readonly #clientId?: string;\n\n readonly #clientVersion?: string;\n\n readonly #environmentDomain: string;\n\n /**\n * Constructs a new SentinelApiService.\n *\n * @param options - The constructor options. See\n * {@link SentinelApiServiceOptions}.\n * @param options.messenger - The messenger suited for this service.\n * @param options.fetch - The `fetch` function to use for requests. Defaults\n * to the global `fetch`.\n * @param options.environment - The Sentinel API environment to target\n * (`dev`, `uat`, or `prod`). Defaults to `prod`.\n * @param options.clientId - Identifier for the calling client (for example\n * `extension` or `mobile`), sent as the `X-Client-Id` header.\n * @param options.clientVersion - Version of the calling client, sent as the\n * `X-Client-Version` header when provided.\n * @param options.queryClientConfig - Configuration for the underlying\n * TanStack Query client.\n * @param options.policyOptions - Options to pass to `createServicePolicy`.\n * Retries are disabled by default (`maxRetries: 0`) to preserve the\n * single-attempt behaviour of the clients this service replaces; pass\n * `maxRetries` here to opt in.\n */\n constructor({\n messenger,\n fetch: fetchFunction = globalThis.fetch,\n environment = DEFAULT_ENVIRONMENT,\n clientId,\n clientVersion,\n queryClientConfig = {},\n policyOptions = {},\n }: SentinelApiServiceOptions) {\n super({\n name: serviceName,\n messenger,\n queryClientConfig,\n policyOptions: {\n // Disable retries by default so the service is behaviourally\n // backwards-compatible with the single-request clients it replaces.\n // Callers can override via `policyOptions.maxRetries`.\n maxRetries: 0,\n retryFilterPolicy: handleWhen(\n (error) =>\n !(error instanceof SentinelApiResponseValidationError) &&\n !(error instanceof SentinelChainNotSupportedError) &&\n !(error instanceof SentinelJsonRpcError),\n ),\n ...policyOptions,\n },\n });\n\n this.#fetch = fetchFunction;\n this.#environmentDomain = ENVIRONMENT_DOMAIN[environment];\n this.#clientId = clientId;\n this.#clientVersion = clientVersion;\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n\n log('Initialized');\n }\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 */\n async getNetwork(chainId: Hex): Promise<SentinelNetwork> {\n const registryEntry = await this.#getRegistryEntry(chainId);\n\n if (!registryEntry) {\n throw new SentinelChainNotSupportedError(chainId);\n }\n\n const url = `${this.#buildUrl(registryEntry.network)}${ENDPOINT_NETWORK}`;\n\n const result = await this.fetchQuery({\n queryKey: [`${this.name}:getNetwork`, chainId],\n staleTime: NETWORK_STALE_TIME_MS,\n queryFn: async (): Promise<Json> => {\n const headers = await this.#getHeaders();\n\n log('getNetwork', 'Request', url);\n\n const response = await this.#fetch(url, { headers });\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Sentinel API: Network request failed with status '${response.status}'`,\n );\n }\n\n const json = (await response.json()) as Json;\n\n const [error] = validate(json, SentinelNetworkStruct);\n if (error) {\n throw new SentinelApiResponseValidationError(\n `Sentinel API: Malformed response from network endpoint: ${error.message}`,\n );\n }\n\n log('getNetwork', 'Response', json);\n\n return json;\n },\n });\n\n return result as unknown as SentinelNetwork;\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 */\n async getNetworks(): Promise<SentinelNetworkRegistry> {\n const url = `${this.#buildUrl(NETWORKS_SUBDOMAIN)}${ENDPOINT_NETWORKS}`;\n\n const result = await this.fetchQuery({\n queryKey: [`${this.name}:getNetworks`],\n staleTime: NETWORKS_STALE_TIME_MS,\n queryFn: async (): Promise<Json> => {\n const headers = await this.#getHeaders();\n\n log('getNetworks', 'Request', url);\n\n const response = await this.#fetch(url, { headers });\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Sentinel API: Networks request failed with status '${response.status}'`,\n );\n }\n\n const json: Json = await response.json();\n\n const [error] = validate(json, SentinelNetworkRegistryStruct);\n if (error) {\n throw new SentinelApiResponseValidationError(\n `Sentinel API: Malformed response from networks endpoint: ${error.message}`,\n );\n }\n\n log('getNetworks', 'Response', json);\n\n return json;\n },\n });\n\n return result as unknown as SentinelNetworkRegistry;\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 */\n async simulateTransactions(\n chainId: Hex,\n request: SentinelSimulationRequest,\n options: { getUrl?: (defaultUrl: string) => string | Promise<string> } = {},\n ): Promise<SentinelSimulationResponse> {\n const defaultUrl = await this.#resolveUrl(chainId, 'confirmations');\n const url = options.getUrl ? await options.getUrl(defaultUrl) : defaultUrl;\n\n const result = await this.fetchQuery({\n queryKey: [`${this.name}:simulateTransactions`, chainId, request, url],\n staleTime: 0,\n queryFn: async (): Promise<Json> => {\n log('simulateTransactions', 'Request', url, request);\n\n const rpcResult = await this.#jsonRpc(url, RPC_METHOD_SIMULATE, [\n request,\n ]);\n\n const [error] = validate(rpcResult, SentinelSimulationResponseStruct);\n if (error) {\n throw new SentinelApiResponseValidationError(\n `Sentinel API: Malformed response from simulation endpoint: ${error.message}`,\n );\n }\n\n log('simulateTransactions', 'Response', rpcResult);\n\n return rpcResult;\n },\n });\n\n return result as unknown as SentinelSimulationResponse;\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 */\n async submitRelayTransaction(\n request: SentinelRelaySubmitRequest,\n ): Promise<SentinelRelaySubmitResponse> {\n const url = await this.#resolveUrl(request.chainId, 'relayTransactions');\n\n const result = await this.fetchQuery({\n queryKey: [`${this.name}:submitRelayTransaction`, request],\n staleTime: 0,\n queryFn: async (): Promise<Json> => {\n log('submitRelayTransaction', 'Request', url, request);\n\n const rpcResult = await this.#jsonRpc(url, RPC_METHOD_SEND_RELAY, [\n request,\n ]);\n\n const [error] = validate(rpcResult, SentinelRelaySubmitResponseStruct);\n if (error) {\n throw new SentinelApiResponseValidationError(\n `Sentinel API: Malformed response from relay submit endpoint: ${error.message}`,\n );\n }\n\n log('submitRelayTransaction', 'Response', rpcResult);\n\n return rpcResult;\n },\n });\n\n return result as unknown as SentinelRelaySubmitResponse;\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 */\n async getSmartTransaction(\n request: SentinelSmartTransactionRequest,\n ): Promise<SentinelSmartTransactionResponse> {\n const { chainId, uuid } = request;\n const baseUrl = await this.#resolveUrl(chainId, 'relayTransactions');\n const url = `${baseUrl}${ENDPOINT_SMART_TRANSACTIONS}/${uuid}`;\n\n const result = await this.fetchQuery({\n queryKey: [`${this.name}:getSmartTransaction`, chainId, uuid],\n staleTime: 0,\n queryFn: async (): Promise<Json> => {\n const headers = await this.#getHeaders();\n\n log('getSmartTransaction', 'Request', url);\n\n const response = await this.#fetch(url, { headers });\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Sentinel API: Smart-transaction request failed with status '${response.status}'`,\n );\n }\n\n const json: Json = await response.json();\n\n const [error] = validate(json, SentinelSmartTransactionResponseStruct);\n if (error) {\n throw new SentinelApiResponseValidationError(\n `Sentinel API: Malformed response from smart-transactions endpoint: ${error.message}`,\n );\n }\n\n log('getSmartTransaction', 'Response', json);\n\n return json;\n },\n });\n\n return result as unknown as SentinelSmartTransactionResponse;\n }\n\n /**\n * Quotes gas fees for unsigned smart transactions via\n * `POST /v1/networks/{chainId}/getFees`. Not cached, since a quote goes\n * stale immediately.\n *\n * @param request - The fee quote request.\n * @returns The fee quote response. One entry in `txs` per transaction, in\n * request order.\n */\n async getFees(\n request: SentinelGetFeesRequest,\n ): Promise<SentinelGetFeesResponse> {\n const { chainId, transactions } = request;\n const baseUrl = await this.#resolveUrl(chainId, 'confirmations');\n const chainIdDecimal = BigInt(chainId).toString(10);\n const url = `${baseUrl}v1/networks/${chainIdDecimal}/getFees`;\n\n const result = await this.fetchQuery({\n queryKey: [`${this.name}:getFees`, request],\n staleTime: 0,\n queryFn: async (): Promise<Json> => {\n const headers = await this.#getHeaders();\n\n log('getFees', 'Request', url, request);\n\n const response = await this.#fetch(url, {\n method: 'POST',\n headers: {\n ...headers,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ txs: transactions }),\n });\n\n if (!response.ok) {\n const data = await readJsonBody(response);\n const error = new HttpError(\n response.status,\n `Sentinel API: getFees request failed with status '${response.status}'`,\n );\n if (data !== undefined) {\n Object.assign(error, { data });\n }\n throw error;\n }\n\n const json = (await response.json()) as Json;\n\n const [error] = validate(json, SentinelGetFeesResponseStruct);\n if (error) {\n throw new SentinelApiResponseValidationError(\n `Sentinel API: Malformed response from /getFees endpoint: ${error.message}`,\n );\n }\n\n log('getFees', 'Response', json);\n\n return json;\n },\n });\n\n return result as unknown as SentinelGetFeesResponse;\n }\n\n /**\n * Submits signed smart transactions via\n * `POST /v1/networks/{chainId}/submitTransactions`. Not cached.\n *\n * @param request - The submit request.\n * @returns The UUID assigned to the submitted batch.\n */\n async submitTransactions(\n request: SentinelSubmitTransactionsRequest,\n ): Promise<SentinelSubmitTransactionsResponse> {\n const { chainId, rawTxs, rawCancelTxs, rawTxsWithMetadata } = request;\n const baseUrl = await this.#resolveUrl(chainId, 'confirmations');\n const chainIdDecimal = BigInt(chainId).toString(10);\n const url = `${baseUrl}v1/networks/${chainIdDecimal}/submitTransactions`;\n\n const result = await this.fetchQuery({\n queryKey: [`${this.name}:submitTransactions`, request],\n staleTime: 0,\n queryFn: async (): Promise<Json> => {\n const headers = await this.#getHeaders();\n\n log('submitTransactions', 'Request', url, request);\n\n const response = await this.#fetch(url, {\n method: 'POST',\n headers: {\n ...headers,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n rawTxs,\n ...(rawCancelTxs === undefined ? {} : { rawCancelTxs }),\n ...(rawTxsWithMetadata === undefined ? {} : { rawTxsWithMetadata }),\n }),\n });\n\n if (!response.ok) {\n const data = await readJsonBody(response);\n const error = new HttpError(\n response.status,\n `Sentinel API: submitTransactions request failed with status '${response.status}'`,\n );\n if (data !== undefined) {\n Object.assign(error, { data });\n }\n throw error;\n }\n\n const json = (await response.json()) as Json;\n\n const [error] = validate(\n json,\n SentinelSubmitTransactionsResponseStruct,\n );\n if (error) {\n throw new SentinelApiResponseValidationError(\n `Sentinel API: Malformed response from /submitTransactions endpoint: ${error.message}`,\n );\n }\n\n log('submitTransactions', 'Response', json);\n\n return json;\n },\n });\n\n return result as unknown as SentinelSubmitTransactionsResponse;\n }\n\n /**\n * Cancels a smart transaction via `POST /v1/networks/{chainId}/cancel`.\n * Not cached.\n *\n * @param request - The cancel request.\n * @returns The cancel result. `cancelled` is `true` on success.\n */\n async cancel(\n request: SentinelCancelRequest,\n ): Promise<SentinelCancelResponse> {\n const { chainId, uuid } = request;\n const baseUrl = await this.#resolveUrl(chainId, 'confirmations');\n const chainIdDecimal = BigInt(chainId).toString(10);\n const url = `${baseUrl}v1/networks/${chainIdDecimal}/cancel`;\n\n const result = await this.fetchQuery({\n queryKey: [`${this.name}:cancel`, request],\n staleTime: 0,\n queryFn: async (): Promise<Json> => {\n const headers = await this.#getHeaders();\n\n log('cancel', 'Request', url, request);\n\n const response = await this.#fetch(url, {\n method: 'POST',\n headers: {\n ...headers,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ uuid }),\n });\n\n if (!response.ok) {\n const data = await readJsonBody(response);\n const error = new HttpError(\n response.status,\n `Sentinel API: Cancel request failed with status '${response.status}'`,\n );\n if (data !== undefined) {\n Object.assign(error, { data });\n }\n throw error;\n }\n\n const json = (await response.json()) as Json;\n\n const [error] = validate(json, SentinelCancelResponseStruct);\n if (error) {\n throw new SentinelApiResponseValidationError(\n `Sentinel API: Malformed response from /cancel endpoint: ${error.message}`,\n );\n }\n\n log('cancel', 'Response', json);\n\n return json;\n },\n });\n\n return result as unknown as SentinelCancelResponse;\n }\n\n /**\n * Looks up the statuses of several smart transactions via\n * `GET /v1/networks/{chainId}/batchStatus`. Not cached, since statuses change\n * while transactions are pending.\n *\n * @param request - The batch status request.\n * @returns The status of each requested transaction, keyed by UUID.\n */\n async getBatchStatus(\n request: SentinelBatchStatusRequest,\n ): Promise<SentinelBatchStatusResponse> {\n const { chainId, uuids } = request;\n const baseUrl = await this.#resolveUrl(chainId, 'confirmations');\n const chainIdDecimal = BigInt(chainId).toString(10);\n const query = new URLSearchParams({ uuids: uuids.join(',') });\n const url = `${baseUrl}v1/networks/${chainIdDecimal}/batchStatus?${query.toString()}`;\n\n const result = await this.fetchQuery({\n queryKey: [`${this.name}:getBatchStatus`, request],\n staleTime: 0,\n queryFn: async (): Promise<Json> => {\n const headers = await this.#getHeaders();\n\n log('getBatchStatus', 'Request', url, request);\n\n const response = await this.#fetch(url, { headers });\n\n if (!response.ok) {\n const data = await readJsonBody(response);\n const error = new HttpError(\n response.status,\n `Sentinel API: Batch status request failed with status '${response.status}'`,\n );\n if (data !== undefined) {\n Object.assign(error, { data });\n }\n throw error;\n }\n\n const json = (await response.json()) as Json;\n\n const [error] = validate(json, SentinelBatchStatusResponseStruct);\n if (error) {\n throw new SentinelApiResponseValidationError(\n `Sentinel API: Malformed response from /batchStatus endpoint: ${error.message}`,\n );\n }\n\n log('getBatchStatus', 'Response', json);\n\n return json;\n },\n });\n\n return result as unknown as SentinelBatchStatusResponse;\n }\n\n /**\n * Performs a JSON-RPC POST to the Sentinel API and returns the `result`.\n *\n * @param url - The URL to post to.\n * @param method - The JSON-RPC method name.\n * @param params - The JSON-RPC params.\n * @returns The `result` field of the JSON-RPC response.\n */\n async #jsonRpc(url: string, method: string, params: Json[]): Promise<Json> {\n const headers = await this.#getHeaders();\n\n const response = await this.#fetch(url, {\n method: 'POST',\n headers: {\n ...headers,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n id: '1',\n jsonrpc: '2.0',\n method,\n params,\n }),\n });\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Sentinel API: JSON-RPC request '${method}' failed with status '${response.status}'`,\n );\n }\n\n const responseJson = (await response.json()) as {\n error?: { code?: number; message?: string };\n result?: Json;\n };\n\n if (responseJson.error) {\n const { code, message } = responseJson.error;\n throw new SentinelJsonRpcError(\n `Sentinel API: JSON-RPC error: ${message}`,\n code,\n );\n }\n\n if (responseJson.result === undefined) {\n throw new SentinelJsonRpcError(\n 'Sentinel API: JSON-RPC response missing result',\n -32603,\n );\n }\n\n return responseJson.result;\n }\n\n /**\n * Builds the outbound headers for a Sentinel request: the client identity\n * headers plus a best-effort `Authorization` bearer token. Token retrieval\n * failures are swallowed so unauthenticated requests still proceed.\n *\n * @returns The headers to attach to the request.\n */\n async #getHeaders(): Promise<Record<string, string>> {\n const headers: Record<string, string> = {};\n\n if (this.#clientId !== undefined) {\n headers['X-Client-Id'] = this.#clientId;\n }\n\n if (this.#clientVersion !== undefined) {\n headers['X-Client-Version'] = this.#clientVersion;\n }\n\n try {\n const token = await this.messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n if (token) {\n headers.Authorization = `Bearer ${token}`;\n }\n } catch (error: unknown) {\n // Proceed without auth if token retrieval fails.\n log(\n 'getHeaders',\n 'Auth token unavailable, proceeding unauthenticated',\n error,\n );\n }\n\n return headers;\n }\n\n /**\n * Resolves the Sentinel URL for a chain, asserting the required capability.\n *\n * @param chainId - The chain ID to resolve a URL for.\n * @param capability - The capability flag that must be enabled.\n * @returns The resolved base URL.\n */\n async #resolveUrl(\n chainId: Hex,\n capability: 'confirmations' | 'relayTransactions',\n ): Promise<string> {\n const network = await this.#getRegistryEntry(chainId);\n\n if (!network?.[capability]) {\n throw new SentinelChainNotSupportedError(chainId, capability);\n }\n\n return this.#buildUrl(network.network);\n }\n\n /**\n * Looks up a single network entry from the registry by chain ID.\n *\n * @param chainId - The chain ID to look up.\n * @returns The network entry, or undefined if not present.\n */\n async #getRegistryEntry(chainId: Hex): Promise<SentinelNetwork | undefined> {\n const registry = await this.getNetworks();\n const chainIdDecimal = BigInt(chainId).toString(10);\n return registry[chainIdDecimal];\n }\n\n /**\n * Builds a Sentinel base URL for the given network subdomain, targeting the\n * environment this service was constructed with.\n *\n * @param subdomain - The network subdomain (for example `ethereum-mainnet`).\n * @returns The full base URL.\n */\n #buildUrl(subdomain: string): string {\n return BASE_URL_TEMPLATE.replace('{0}', subdomain).replace(\n '{1}',\n this.#environmentDomain,\n );\n }\n}\n\n/**\n * Reads a response body as JSON. Returns undefined when the body is empty or\n * not JSON, so a failed request can still surface its HTTP status.\n *\n * @param response - The response to read.\n * @returns The parsed JSON body, or undefined.\n */\nasync function readJsonBody(response: Response): Promise<Json | undefined> {\n try {\n return (await response.json()) as Json;\n } catch {\n return undefined;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sentinel-api-service.js","sourceRoot":"","sources":["../src/sentinel-api-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,2BAA2B,EAC3B,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,kCAAkC,EAClC,8BAA8B,EAC9B,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EACL,sCAAsC,EACtC,iCAAiC,EACjC,6BAA6B,EAC7B,qBAAqB,EACrB,4BAA4B,EAC5B,6BAA6B,EAC7B,iCAAiC,EACjC,gCAAgC,EAChC,wCAAwC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,IAAI,CAAC,kBAAkB,CACxB,CAAC;IACJ,CAAC;CACF;AAED;;;;;;GAMG;AACH,KAAK,UAAU,YAAY,CAAC,QAAkB;IAC5C,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAS,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,KAAK,UAAU,SAAS,CACtB,QAAwC,EACxC,EAA2C;IAE3C,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,EAAgB,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import { BaseDataService } from '@metamask/base-data-service';\nimport { handleWhen, HttpError } from '@metamask/controller-utils';\nimport type { TraceContext } from '@metamask/controller-utils';\nimport { validate } from '@metamask/superstruct';\nimport type { Hex, Json } from '@metamask/utils';\n\nimport {\n BASE_URL_TEMPLATE,\n DEFAULT_ENVIRONMENT,\n ENDPOINT_NETWORK,\n ENDPOINT_NETWORKS,\n ENDPOINT_SMART_TRANSACTIONS,\n ENVIRONMENT_DOMAIN,\n NETWORK_STALE_TIME_MS,\n NETWORKS_STALE_TIME_MS,\n NETWORKS_SUBDOMAIN,\n RPC_METHOD_SEND_RELAY,\n RPC_METHOD_SIMULATE,\n serviceName,\n} from './constants.js';\nimport {\n SentinelApiResponseValidationError,\n SentinelChainNotSupportedError,\n SentinelJsonRpcError,\n} from './errors.js';\nimport { projectLogger, createModuleLogger } from './logger.js';\nimport {\n SentinelSmartTransactionResponseStruct,\n SentinelBatchStatusResponseStruct,\n SentinelNetworkRegistryStruct,\n SentinelNetworkStruct,\n SentinelCancelResponseStruct,\n SentinelGetFeesResponseStruct,\n SentinelRelaySubmitResponseStruct,\n SentinelSimulationResponseStruct,\n SentinelSubmitTransactionsResponseStruct,\n} from './structs.js';\nimport type {\n SentinelApiServiceMessenger,\n SentinelApiServiceOptions,\n SentinelApiServiceTraceCallback,\n SentinelApiServiceTraceOptions,\n SentinelApiServiceTraceRequest,\n SentinelBatchStatusRequest,\n SentinelBatchStatusResponse,\n SentinelCancelRequest,\n SentinelCancelResponse,\n SentinelGetFeesRequest,\n SentinelGetFeesResponse,\n SentinelNetwork,\n SentinelNetworkRegistry,\n SentinelRelaySubmitRequest,\n SentinelRelaySubmitResponse,\n SentinelSimulationRequest,\n SentinelSimulationResponse,\n SentinelSmartTransactionRequest,\n SentinelSmartTransactionResponse,\n SentinelSubmitTransactionsRequest,\n SentinelSubmitTransactionsResponse,\n} from './types.js';\nimport { TRACES } from './types.js';\n\nconst log = createModuleLogger(projectLogger, serviceName);\nconst traceLogger = createModuleLogger(projectLogger, 'trace');\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'cancel',\n 'getBatchStatus',\n 'getFees',\n 'getNetwork',\n 'getNetworks',\n 'simulateTransactions',\n 'submitRelayTransaction',\n 'submitTransactions',\n 'getSmartTransaction',\n] as const;\n\n/**\n * Data service that centralises all interactions with the MetaMask Sentinel\n * API (`tx-sentinel-<network>.api.cx.metamask.io`).\n *\n * It exposes one method per Sentinel endpoint:\n * - {@link SentinelApiService.getNetwork} — the configuration of a single\n * network (`/network`). Not cached since it is the sentinel live capabilities endpoint.\n * - {@link SentinelApiService.getNetworks} — the supported-network registry\n * (`/networks`), cached since it is stable and identical across subdomains.\n * - {@link SentinelApiService.simulateTransactions} — transaction simulation\n * (`infura_simulateTransactions`), used by `@metamask/transaction-controller`\n * and `@metamask/transaction-pay-controller`.\n * - {@link SentinelApiService.submitRelayTransaction} — gas station relay\n * submission (`eth_sendRelayTransaction`), used by the extension and mobile.\n * - {@link SentinelApiService.getSmartTransaction} — smart-transaction status\n * lookup (`/smart-transactions/{uuid}`).\n * - {@link SentinelApiService.getFees} — smart-transaction fee quotes\n * (`POST /v1/networks/{chainId}/getFees`). Not cached.\n * - {@link SentinelApiService.submitTransactions} — signed smart-transaction\n * submission (`POST /v1/networks/{chainId}/submitTransactions`). Not cached.\n * - {@link SentinelApiService.cancel} — smart-transaction cancellation\n * (`POST /v1/networks/{chainId}/cancel`). Not cached.\n * - {@link SentinelApiService.getBatchStatus} — smart-transaction status lookup\n * for several UUIDs (`GET /v1/networks/{chainId}/batchStatus`). Not cached.\n *\n * Consumers derive higher-level concerns (whether a chain supports simulation\n * or relay, polling loops, etc.) from the raw endpoint responses.\n */\nexport class SentinelApiService extends BaseDataService<\n typeof serviceName,\n SentinelApiServiceMessenger\n> {\n readonly #fetch: typeof fetch;\n\n readonly #clientId?: string;\n\n readonly #clientVersion?: string;\n\n readonly #environmentDomain: string;\n\n readonly #trace: SentinelApiServiceTraceCallback;\n\n /**\n * Constructs a new SentinelApiService.\n *\n * @param options - The constructor options. See\n * {@link SentinelApiServiceOptions}.\n * @param options.messenger - The messenger suited for this service.\n * @param options.fetch - The `fetch` function to use for requests. Defaults\n * to the global `fetch`.\n * @param options.environment - The Sentinel API environment to target\n * (`dev`, `uat`, or `prod`). Defaults to `prod`.\n * @param options.clientId - Identifier for the calling client (for example\n * `extension` or `mobile`), sent as the `X-Client-Id` header.\n * @param options.clientVersion - Version of the calling client, sent as the\n * `X-Client-Version` header when provided.\n * @param options.queryClientConfig - Configuration for the underlying\n * TanStack Query client.\n * @param options.policyOptions - Options to pass to `createServicePolicy`.\n * Retries are disabled by default (`maxRetries: 0`) to preserve the\n * single-attempt behaviour of the clients this service replaces; pass\n * `maxRetries` here to opt in.\n * @param options.trace - Optional callback to trace network requests.\n * Tracing is best-effort and does not affect the request result if it fails.\n */\n constructor({\n messenger,\n fetch: fetchFunction = globalThis.fetch,\n environment = DEFAULT_ENVIRONMENT,\n clientId,\n clientVersion,\n queryClientConfig = {},\n policyOptions = {},\n trace,\n }: SentinelApiServiceOptions) {\n super({\n name: serviceName,\n messenger,\n queryClientConfig,\n policyOptions: {\n // Disable retries by default so the service is behaviourally\n // backwards-compatible with the single-request clients it replaces.\n // Callers can override via `policyOptions.maxRetries`.\n maxRetries: 0,\n retryFilterPolicy: handleWhen(\n (error) =>\n !(error instanceof SentinelApiResponseValidationError) &&\n !(error instanceof SentinelChainNotSupportedError) &&\n !(error instanceof SentinelJsonRpcError),\n ),\n ...policyOptions,\n },\n });\n\n this.#fetch = fetchFunction;\n this.#environmentDomain = ENVIRONMENT_DOMAIN[environment];\n this.#clientId = clientId;\n this.#clientVersion = clientVersion;\n this.#trace = trace ?? noopTrace;\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n\n log('Initialized');\n }\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. Not cached as it is the sentinel live capabilities endpoint.\n *\n * @param chainId - The chain ID of the network.\n * @returns The network configuration.\n */\n async getNetwork(chainId: Hex): Promise<SentinelNetwork> {\n const registryEntry = await this.#getRegistryEntry(chainId);\n\n if (!registryEntry) {\n throw new SentinelChainNotSupportedError(chainId);\n }\n\n const url = `${this.#buildUrl(registryEntry.network)}${ENDPOINT_NETWORK}`;\n\n const result = await this.fetchQuery({\n queryKey: [`${this.name}:getNetwork`, chainId],\n staleTime: NETWORK_STALE_TIME_MS,\n queryFn: async (): Promise<Json> => {\n const headers = await this.#getHeaders();\n\n log('getNetwork', 'Request', url);\n\n const response = await this.#fetch(url, { headers });\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Sentinel API: Network request failed with status '${response.status}'`,\n );\n }\n\n const json = (await response.json()) as Json;\n\n const [error] = validate(json, SentinelNetworkStruct);\n if (error) {\n throw new SentinelApiResponseValidationError(\n `Sentinel API: Malformed response from network endpoint: ${error.message}`,\n );\n }\n\n log('getNetwork', 'Response', json);\n\n return json;\n },\n });\n\n return result as unknown as SentinelNetwork;\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 */\n async getNetworks(): Promise<SentinelNetworkRegistry> {\n const url = `${this.#buildUrl(NETWORKS_SUBDOMAIN)}${ENDPOINT_NETWORKS}`;\n\n const result = await this.fetchQuery({\n queryKey: [`${this.name}:getNetworks`],\n staleTime: NETWORKS_STALE_TIME_MS,\n queryFn: async (): Promise<Json> => {\n const headers = await this.#getHeaders();\n\n log('getNetworks', 'Request', url);\n\n const response = await this.#fetch(url, { headers });\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Sentinel API: Networks request failed with status '${response.status}'`,\n );\n }\n\n const json: Json = await response.json();\n\n const [error] = validate(json, SentinelNetworkRegistryStruct);\n if (error) {\n throw new SentinelApiResponseValidationError(\n `Sentinel API: Malformed response from networks endpoint: ${error.message}`,\n );\n }\n\n log('getNetworks', 'Response', json);\n\n return json;\n },\n });\n\n return result as unknown as SentinelNetworkRegistry;\n }\n\n /**\n * Runs a request and emits a best-effort backdated trace.\n *\n * @param request - Trace metadata for the request.\n * @param fn - Request to execute.\n * @returns The request result.\n */\n async #traceRequest<ReturnType>(\n request: SentinelApiServiceTraceRequest,\n fn: () => Promise<ReturnType>,\n ): Promise<ReturnType> {\n const startTime = Date.now();\n let success = false;\n let errorName: string | undefined;\n\n try {\n const result = await fn();\n success = true;\n return result;\n } catch (error) {\n errorName = error instanceof Error ? error.name : typeof error;\n throw error;\n } finally {\n const traceRequest = {\n ...request,\n startTime,\n data: {\n ...request.data,\n success,\n ...(errorName ? { errorName } : {}),\n },\n };\n const onTraceError = (traceError: unknown): void => {\n traceLogger('Failed to emit trace', {\n traceName: request.name,\n traceError,\n });\n };\n\n try {\n Promise.resolve(this.#trace(traceRequest, () => undefined)).catch(\n onTraceError,\n );\n } catch (traceError) {\n onTraceError(traceError);\n }\n }\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 * @param options.traceContext - Optional trace context to nest the\n * simulation trace under. Without it, clients that do not infer a parent\n * from the active span record the trace as a root span.\n * @returns The simulation response.\n */\n async simulateTransactions(\n chainId: Hex,\n request: SentinelSimulationRequest,\n options: {\n getUrl?: (defaultUrl: string) => string | Promise<string>;\n } & SentinelApiServiceTraceOptions = {},\n ): Promise<SentinelSimulationResponse> {\n const defaultUrl = await this.#resolveUrl(chainId, 'confirmations');\n const url = options.getUrl ? await options.getUrl(defaultUrl) : defaultUrl;\n\n const result = await this.fetchQuery({\n queryKey: [`${this.name}:simulateTransactions`, chainId, request, url],\n staleTime: 0,\n queryFn: () =>\n this.#traceRequest(\n {\n name: TRACES.SIMULATE_TRANSACTIONS,\n parentContext: options.traceContext,\n data: {\n chainId,\n transactionCount: request.transactions.length,\n },\n },\n async (): Promise<Json> => {\n log('simulateTransactions', 'Request', url, request);\n\n const rpcResult = await this.#jsonRpc(url, RPC_METHOD_SIMULATE, [\n request,\n ]);\n\n const [error] = validate(\n rpcResult,\n SentinelSimulationResponseStruct,\n );\n if (error) {\n throw new SentinelApiResponseValidationError(\n `Sentinel API: Malformed response from simulation endpoint: ${error.message}`,\n );\n }\n\n log('simulateTransactions', 'Response', rpcResult);\n\n return rpcResult;\n },\n ),\n });\n\n return result as unknown as SentinelSimulationResponse;\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 */\n async submitRelayTransaction(\n request: SentinelRelaySubmitRequest,\n ): Promise<SentinelRelaySubmitResponse> {\n const url = await this.#resolveUrl(request.chainId, 'relayTransactions');\n\n const result = await this.fetchQuery({\n queryKey: [`${this.name}:submitRelayTransaction`, request],\n staleTime: 0,\n queryFn: async (): Promise<Json> => {\n log('submitRelayTransaction', 'Request', url, request);\n\n const rpcResult = await this.#jsonRpc(url, RPC_METHOD_SEND_RELAY, [\n request,\n ]);\n\n const [error] = validate(rpcResult, SentinelRelaySubmitResponseStruct);\n if (error) {\n throw new SentinelApiResponseValidationError(\n `Sentinel API: Malformed response from relay submit endpoint: ${error.message}`,\n );\n }\n\n log('submitRelayTransaction', 'Response', rpcResult);\n\n return rpcResult;\n },\n });\n\n return result as unknown as SentinelRelaySubmitResponse;\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 */\n async getSmartTransaction(\n request: SentinelSmartTransactionRequest,\n ): Promise<SentinelSmartTransactionResponse> {\n const { chainId, uuid } = request;\n const baseUrl = await this.#resolveUrl(chainId, 'relayTransactions');\n const url = `${baseUrl}${ENDPOINT_SMART_TRANSACTIONS}/${uuid}`;\n\n const result = await this.fetchQuery({\n queryKey: [`${this.name}:getSmartTransaction`, chainId, uuid],\n staleTime: 0,\n queryFn: async (): Promise<Json> => {\n const headers = await this.#getHeaders();\n\n log('getSmartTransaction', 'Request', url);\n\n const response = await this.#fetch(url, { headers });\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Sentinel API: Smart-transaction request failed with status '${response.status}'`,\n );\n }\n\n const json: Json = await response.json();\n\n const [error] = validate(json, SentinelSmartTransactionResponseStruct);\n if (error) {\n throw new SentinelApiResponseValidationError(\n `Sentinel API: Malformed response from smart-transactions endpoint: ${error.message}`,\n );\n }\n\n log('getSmartTransaction', 'Response', json);\n\n return json;\n },\n });\n\n return result as unknown as SentinelSmartTransactionResponse;\n }\n\n /**\n * Quotes gas fees for unsigned smart transactions via\n * `POST /v1/networks/{chainId}/getFees`. Not cached, since a quote goes\n * stale immediately.\n *\n * @param request - The fee quote request.\n * @returns The fee quote response. One entry in `txs` per transaction, in\n * request order.\n */\n async getFees(\n request: SentinelGetFeesRequest,\n ): Promise<SentinelGetFeesResponse> {\n const { chainId, transactions } = request;\n const baseUrl = await this.#resolveUrl(chainId, 'confirmations');\n const chainIdDecimal = BigInt(chainId).toString(10);\n const url = `${baseUrl}v1/networks/${chainIdDecimal}/getFees`;\n\n const result = await this.fetchQuery({\n queryKey: [`${this.name}:getFees`, request],\n staleTime: 0,\n queryFn: async (): Promise<Json> => {\n const headers = await this.#getHeaders();\n\n log('getFees', 'Request', url, request);\n\n const response = await this.#fetch(url, {\n method: 'POST',\n headers: {\n ...headers,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ txs: transactions }),\n });\n\n if (!response.ok) {\n const data = await readJsonBody(response);\n const error = new HttpError(\n response.status,\n `Sentinel API: getFees request failed with status '${response.status}'`,\n );\n if (data !== undefined) {\n Object.assign(error, { data });\n }\n throw error;\n }\n\n const json = (await response.json()) as Json;\n\n const [error] = validate(json, SentinelGetFeesResponseStruct);\n if (error) {\n throw new SentinelApiResponseValidationError(\n `Sentinel API: Malformed response from /getFees endpoint: ${error.message}`,\n );\n }\n\n log('getFees', 'Response', json);\n\n return json;\n },\n });\n\n return result as unknown as SentinelGetFeesResponse;\n }\n\n /**\n * Submits signed smart transactions via\n * `POST /v1/networks/{chainId}/submitTransactions`. Not cached.\n *\n * @param request - The submit request.\n * @returns The UUID assigned to the submitted batch.\n */\n async submitTransactions(\n request: SentinelSubmitTransactionsRequest,\n ): Promise<SentinelSubmitTransactionsResponse> {\n const { chainId, rawTxs, rawCancelTxs, rawTxsWithMetadata } = request;\n const baseUrl = await this.#resolveUrl(chainId, 'confirmations');\n const chainIdDecimal = BigInt(chainId).toString(10);\n const url = `${baseUrl}v1/networks/${chainIdDecimal}/submitTransactions`;\n\n const result = await this.fetchQuery({\n queryKey: [`${this.name}:submitTransactions`, request],\n staleTime: 0,\n queryFn: async (): Promise<Json> => {\n const headers = await this.#getHeaders();\n\n log('submitTransactions', 'Request', url, request);\n\n const response = await this.#fetch(url, {\n method: 'POST',\n headers: {\n ...headers,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n rawTxs,\n ...(rawCancelTxs === undefined ? {} : { rawCancelTxs }),\n ...(rawTxsWithMetadata === undefined ? {} : { rawTxsWithMetadata }),\n }),\n });\n\n if (!response.ok) {\n const data = await readJsonBody(response);\n const error = new HttpError(\n response.status,\n `Sentinel API: submitTransactions request failed with status '${response.status}'`,\n );\n if (data !== undefined) {\n Object.assign(error, { data });\n }\n throw error;\n }\n\n const json = (await response.json()) as Json;\n\n const [error] = validate(\n json,\n SentinelSubmitTransactionsResponseStruct,\n );\n if (error) {\n throw new SentinelApiResponseValidationError(\n `Sentinel API: Malformed response from /submitTransactions endpoint: ${error.message}`,\n );\n }\n\n log('submitTransactions', 'Response', json);\n\n return json;\n },\n });\n\n return result as unknown as SentinelSubmitTransactionsResponse;\n }\n\n /**\n * Cancels a smart transaction via `POST /v1/networks/{chainId}/cancel`.\n * Not cached.\n *\n * @param request - The cancel request.\n * @returns The cancel result. `cancelled` is `true` on success.\n */\n async cancel(\n request: SentinelCancelRequest,\n ): Promise<SentinelCancelResponse> {\n const { chainId, uuid } = request;\n const baseUrl = await this.#resolveUrl(chainId, 'confirmations');\n const chainIdDecimal = BigInt(chainId).toString(10);\n const url = `${baseUrl}v1/networks/${chainIdDecimal}/cancel`;\n\n const result = await this.fetchQuery({\n queryKey: [`${this.name}:cancel`, request],\n staleTime: 0,\n queryFn: async (): Promise<Json> => {\n const headers = await this.#getHeaders();\n\n log('cancel', 'Request', url, request);\n\n const response = await this.#fetch(url, {\n method: 'POST',\n headers: {\n ...headers,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ uuid }),\n });\n\n if (!response.ok) {\n const data = await readJsonBody(response);\n const error = new HttpError(\n response.status,\n `Sentinel API: Cancel request failed with status '${response.status}'`,\n );\n if (data !== undefined) {\n Object.assign(error, { data });\n }\n throw error;\n }\n\n const json = (await response.json()) as Json;\n\n const [error] = validate(json, SentinelCancelResponseStruct);\n if (error) {\n throw new SentinelApiResponseValidationError(\n `Sentinel API: Malformed response from /cancel endpoint: ${error.message}`,\n );\n }\n\n log('cancel', 'Response', json);\n\n return json;\n },\n });\n\n return result as unknown as SentinelCancelResponse;\n }\n\n /**\n * Looks up the statuses of several smart transactions via\n * `GET /v1/networks/{chainId}/batchStatus`. Not cached, since statuses change\n * while transactions are pending.\n *\n * @param request - The batch status request.\n * @returns The status of each requested transaction, keyed by UUID.\n */\n async getBatchStatus(\n request: SentinelBatchStatusRequest,\n ): Promise<SentinelBatchStatusResponse> {\n const { chainId, uuids } = request;\n const baseUrl = await this.#resolveUrl(chainId, 'confirmations');\n const chainIdDecimal = BigInt(chainId).toString(10);\n const query = new URLSearchParams({ uuids: uuids.join(',') });\n const url = `${baseUrl}v1/networks/${chainIdDecimal}/batchStatus?${query.toString()}`;\n\n const result = await this.fetchQuery({\n queryKey: [`${this.name}:getBatchStatus`, request],\n staleTime: 0,\n queryFn: async (): Promise<Json> => {\n const headers = await this.#getHeaders();\n\n log('getBatchStatus', 'Request', url, request);\n\n const response = await this.#fetch(url, { headers });\n\n if (!response.ok) {\n const data = await readJsonBody(response);\n const error = new HttpError(\n response.status,\n `Sentinel API: Batch status request failed with status '${response.status}'`,\n );\n if (data !== undefined) {\n Object.assign(error, { data });\n }\n throw error;\n }\n\n const json = (await response.json()) as Json;\n\n const [error] = validate(json, SentinelBatchStatusResponseStruct);\n if (error) {\n throw new SentinelApiResponseValidationError(\n `Sentinel API: Malformed response from /batchStatus endpoint: ${error.message}`,\n );\n }\n\n log('getBatchStatus', 'Response', json);\n\n return json;\n },\n });\n\n return result as unknown as SentinelBatchStatusResponse;\n }\n\n /**\n * Performs a JSON-RPC POST to the Sentinel API and returns the `result`.\n *\n * @param url - The URL to post to.\n * @param method - The JSON-RPC method name.\n * @param params - The JSON-RPC params.\n * @returns The `result` field of the JSON-RPC response.\n */\n async #jsonRpc(url: string, method: string, params: Json[]): Promise<Json> {\n const headers = await this.#getHeaders();\n\n const response = await this.#fetch(url, {\n method: 'POST',\n headers: {\n ...headers,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n id: '1',\n jsonrpc: '2.0',\n method,\n params,\n }),\n });\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Sentinel API: JSON-RPC request '${method}' failed with status '${response.status}'`,\n );\n }\n\n const responseJson = (await response.json()) as {\n error?: { code?: number; message?: string };\n result?: Json;\n };\n\n if (responseJson.error) {\n const { code, message } = responseJson.error;\n throw new SentinelJsonRpcError(\n `Sentinel API: JSON-RPC error: ${message}`,\n code,\n );\n }\n\n if (responseJson.result === undefined) {\n throw new SentinelJsonRpcError(\n 'Sentinel API: JSON-RPC response missing result',\n -32603,\n );\n }\n\n return responseJson.result;\n }\n\n /**\n * Builds the outbound headers for a Sentinel request: the client identity\n * headers plus a best-effort `Authorization` bearer token. Token retrieval\n * failures are swallowed so unauthenticated requests still proceed.\n *\n * @returns The headers to attach to the request.\n */\n async #getHeaders(): Promise<Record<string, string>> {\n const headers: Record<string, string> = {};\n\n if (this.#clientId !== undefined) {\n headers['X-Client-Id'] = this.#clientId;\n }\n\n if (this.#clientVersion !== undefined) {\n headers['X-Client-Version'] = this.#clientVersion;\n }\n\n try {\n const token = await this.messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n if (token) {\n headers.Authorization = `Bearer ${token}`;\n }\n } catch (error: unknown) {\n // Proceed without auth if token retrieval fails.\n log(\n 'getHeaders',\n 'Auth token unavailable, proceeding unauthenticated',\n error,\n );\n }\n\n return headers;\n }\n\n /**\n * Resolves the Sentinel URL for a chain, asserting the required capability.\n *\n * @param chainId - The chain ID to resolve a URL for.\n * @param capability - The capability flag that must be enabled.\n * @returns The resolved base URL.\n */\n async #resolveUrl(\n chainId: Hex,\n capability: 'confirmations' | 'relayTransactions',\n ): Promise<string> {\n const network = await this.#getRegistryEntry(chainId);\n\n if (!network?.[capability]) {\n throw new SentinelChainNotSupportedError(chainId, capability);\n }\n\n return this.#buildUrl(network.network);\n }\n\n /**\n * Looks up a single network entry from the registry by chain ID.\n *\n * @param chainId - The chain ID to look up.\n * @returns The network entry, or undefined if not present.\n */\n async #getRegistryEntry(chainId: Hex): Promise<SentinelNetwork | undefined> {\n const registry = await this.getNetworks();\n const chainIdDecimal = BigInt(chainId).toString(10);\n return registry[chainIdDecimal];\n }\n\n /**\n * Builds a Sentinel base URL for the given network subdomain, targeting the\n * environment this service was constructed with.\n *\n * @param subdomain - The network subdomain (for example `ethereum-mainnet`).\n * @returns The full base URL.\n */\n #buildUrl(subdomain: string): string {\n return BASE_URL_TEMPLATE.replace('{0}', subdomain).replace(\n '{1}',\n this.#environmentDomain,\n );\n }\n}\n\n/**\n * Reads a response body as JSON. Returns undefined when the body is empty or\n * not JSON, so a failed request can still surface its HTTP status.\n *\n * @param response - The response to read.\n * @returns The parsed JSON body, or undefined.\n */\nasync function readJsonBody(response: Response): Promise<Json | undefined> {\n try {\n return (await response.json()) as Json;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Default trace callback used when the client does not pass one. Records\n * nothing and runs `fn` so the callback contract still holds.\n *\n * @param _request - The trace request, ignored.\n * @param fn - Optional work to run.\n * @returns The value returned by `fn`.\n */\nasync function noopTrace<ReturnType>(\n _request: SentinelApiServiceTraceRequest,\n fn?: (context?: TraceContext) => ReturnType,\n): Promise<ReturnType> {\n return await Promise.resolve(fn?.() as ReturnType);\n}\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DataServiceCacheUpdatedEvent, DataServiceGranularCacheUpdatedEvent, DataServiceInvalidateQueriesAction } from '@metamask/base-data-service';
|
|
2
|
-
import type { CreateServicePolicyOptions } from '@metamask/controller-utils';
|
|
2
|
+
import type { CreateServicePolicyOptions, TraceContext, TraceRequest } from '@metamask/controller-utils';
|
|
3
3
|
import type { Messenger } from '@metamask/messenger';
|
|
4
4
|
import type { Hex } from '@metamask/utils';
|
|
5
5
|
import type { QueryClientConfig } from '@tanstack/query-core';
|
|
@@ -43,6 +43,46 @@ type AllowedActions = AuthenticationControllerGetBearerTokenAction;
|
|
|
43
43
|
* {@link SentinelApiService}.
|
|
44
44
|
*/
|
|
45
45
|
export type SentinelApiServiceMessenger = Messenger<typeof serviceName, SentinelApiServiceActions | AllowedActions, SentinelApiServiceEvents>;
|
|
46
|
+
/**
|
|
47
|
+
* Names of operations {@link SentinelApiService} can trace.
|
|
48
|
+
*/
|
|
49
|
+
export declare const TRACES: {
|
|
50
|
+
readonly SIMULATE_TRANSACTIONS: 'Sentinel Simulate Transactions';
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Name of an operation {@link SentinelApiService} can trace.
|
|
54
|
+
*/
|
|
55
|
+
export type SentinelApiServiceTraceName = (typeof TRACES)[keyof typeof TRACES];
|
|
56
|
+
/**
|
|
57
|
+
* Request passed to {@link SentinelApiServiceTraceCallback}.
|
|
58
|
+
*/
|
|
59
|
+
export type SentinelApiServiceTraceRequest = Omit<TraceRequest, 'name'> & {
|
|
60
|
+
/** Name of the operation. */
|
|
61
|
+
name: SentinelApiServiceTraceName;
|
|
62
|
+
/**
|
|
63
|
+
* Override the start time of the trace, in milliseconds.
|
|
64
|
+
* Set by the service so a span recorded after the request can be backdated.
|
|
65
|
+
*/
|
|
66
|
+
startTime?: number;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Options accepted by traced {@link SentinelApiService} methods.
|
|
70
|
+
*/
|
|
71
|
+
export type SentinelApiServiceTraceOptions = {
|
|
72
|
+
/**
|
|
73
|
+
* Trace context to nest the operation's trace under. Without it, clients
|
|
74
|
+
* that do not infer a parent from the active span record the trace as a
|
|
75
|
+
* root span.
|
|
76
|
+
*/
|
|
77
|
+
traceContext?: TraceContext;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Callback that traces the performance of a Sentinel API operation.
|
|
81
|
+
*
|
|
82
|
+
* The service records the trace on a best-effort basis and does not fail the
|
|
83
|
+
* request if tracing throws or rejects.
|
|
84
|
+
*/
|
|
85
|
+
export type SentinelApiServiceTraceCallback = <ReturnType>(request: SentinelApiServiceTraceRequest, fn?: (context?: TraceContext) => ReturnType) => Promise<ReturnType>;
|
|
46
86
|
/**
|
|
47
87
|
* Constructor options for {@link SentinelApiService}.
|
|
48
88
|
*/
|
|
@@ -76,6 +116,11 @@ export type SentinelApiServiceOptions = {
|
|
|
76
116
|
* this service replaces; pass `maxRetries` here to opt in.
|
|
77
117
|
*/
|
|
78
118
|
policyOptions?: CreateServicePolicyOptions;
|
|
119
|
+
/**
|
|
120
|
+
* Optional callback to trace network requests. Tracing is best-effort and
|
|
121
|
+
* does not affect the request result if it fails.
|
|
122
|
+
*/
|
|
123
|
+
trace?: SentinelApiServiceTraceCallback;
|
|
79
124
|
};
|
|
80
125
|
/**
|
|
81
126
|
* The feature that originated a relay (gas station) submission. Used purely as
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EACnC,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,+CAA+C,CAAC;AAErG;;GAEG;AACH,MAAM,MAAM,yCAAyC,GACnD,kCAAkC,CAAC,OAAO,WAAW,CAAC,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,yBAAyB,GACjC,+BAA+B,G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
|
|
2
|
+
* Names of operations {@link SentinelApiService} can trace.
|
|
3
|
+
*/
|
|
4
|
+
export const TRACES = {
|
|
5
|
+
SIMULATE_TRANSACTIONS: 'Sentinel Simulate Transactions',
|
|
6
|
+
};
|
|
1
7
|
/**
|
|
2
8
|
* The feature that originated a relay (gas station) submission. Used purely as
|
|
3
9
|
* metadata forwarded to the Sentinel API for observability. Redefined here so
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAgHA;;;;GAIG;AACH,MAAM,CAAN,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,wCAAqB,CAAA;IACrB,sCAAmB,CAAA;IACnB,0CAAuB,CAAA;AACzB,CAAC,EAJW,eAAe,KAAf,eAAe,QAI1B;AAED;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,mCAAmB,CAAA;IACnB,iDAAiC,CAAA;IACjC,uDAAuC,CAAA;AACzC,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAED,MAAM,CAAN,IAAY,sBAUX;AAVD,WAAY,sBAAsB;IAChC,2CAAiB,CAAA;IACjB,uCAAa,CAAA;IACb,6DAAmC,CAAA;IACnC,uCAAa,CAAA;IACb,uCAAa,CAAA;IACb,mDAAyB,CAAA;IACzB,uCAAa,CAAA;IACb,6CAAmB,CAAA;IACnB,uCAAa,CAAA;AACf,CAAC,EAVW,sBAAsB,KAAtB,sBAAsB,QAUjC;AAsdD;;;GAGG;AACH,MAAM,CAAN,IAAY,8BAIX;AAJD,WAAY,8BAA8B;IACxC,qDAAmB,CAAA;IACnB,yDAAuB,CAAA;IACvB,mDAAiB,CAAA;AACnB,CAAC,EAJW,8BAA8B,KAA9B,8BAA8B,QAIzC;AAiGD;;;GAGG;AACH,MAAM,CAAN,IAAY,0BAOX;AAPD,WAAY,0BAA0B;IACpC,gEAAkC,CAAA;IAClC,4DAA8B,CAAA;IAC9B,4DAA8B,CAAA;IAC9B,oDAAsB,CAAA;IACtB,8DAAgC,CAAA;IAChC,0DAA4B,CAAA;AAC9B,CAAC,EAPW,0BAA0B,KAA1B,0BAA0B,QAOrC;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC/B,gDAAuB,CAAA;IACvB,+CAAsB,CAAA;IACtB,8CAAqB,CAAA;IACrB,4CAAmB,CAAA;AACrB,CAAC,EALW,qBAAqB,KAArB,qBAAqB,QAKhC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,iCAuBX;AAvBD,WAAY,iCAAiC;IAC3C,4DAAuB,CAAA;IACvB,0FAAqD,CAAA;IACrD,4FAAuD,CAAA;IACvD,sDAAiB,CAAA;IACjB,+DAA0B,CAAA;IAC1B,kFAA6C,CAAA;IAC7C,2EAAsC,CAAA;IACtC,sFAAiD,CAAA;IACjD,0FAAqD,CAAA;IACrD,iFAA4C,CAAA;IAC5C,+DAA0B,CAAA;IAC1B,sFAAiD,CAAA;IACjD,qEAAgC,CAAA;IAChC,qEAAgC,CAAA;IAChC,8EAAyC,CAAA;IACzC,uEAAkC,CAAA;IAClC,yEAAoC,CAAA;IACpC,kEAA6B,CAAA;IAC7B,wDAAmB,CAAA;IACnB,2EAAsC,CAAA;IACtC,0DAAqB,CAAA;IACrB,4DAAuB,CAAA;AACzB,CAAC,EAvBW,iCAAiC,KAAjC,iCAAiC,QAuB5C","sourcesContent":["import type {\n DataServiceCacheUpdatedEvent,\n DataServiceGranularCacheUpdatedEvent,\n DataServiceInvalidateQueriesAction,\n} from '@metamask/base-data-service';\nimport type { CreateServicePolicyOptions } from '@metamask/controller-utils';\nimport type { Messenger } from '@metamask/messenger';\nimport type { Hex } from '@metamask/utils';\nimport type { QueryClientConfig } from '@tanstack/query-core';\n\nimport type { SentinelEnvironment, serviceName } from './constants.js';\nimport type { SentinelApiServiceMethodActions } from './sentinel-api-service-method-action-types.js';\n\n/**\n * Invalidates cached queries for {@link SentinelApiService}.\n */\nexport type SentinelApiServiceInvalidateQueriesAction =\n DataServiceInvalidateQueriesAction<typeof serviceName>;\n\n/**\n * Actions that {@link SentinelApiService} exposes to other consumers.\n */\nexport type SentinelApiServiceActions =\n | SentinelApiServiceMethodActions\n | SentinelApiServiceInvalidateQueriesAction;\n\n/**\n * Published when {@link SentinelApiService}'s cache is updated.\n */\nexport type SentinelApiServiceCacheUpdatedEvent = DataServiceCacheUpdatedEvent<\n typeof serviceName\n>;\n\n/**\n * Published when a key within {@link SentinelApiService}'s cache is updated.\n */\nexport type SentinelApiServiceGranularCacheUpdatedEvent =\n DataServiceGranularCacheUpdatedEvent<typeof serviceName>;\n\n/**\n * Events that {@link SentinelApiService} exposes to other consumers.\n */\nexport type SentinelApiServiceEvents =\n | SentinelApiServiceCacheUpdatedEvent\n | SentinelApiServiceGranularCacheUpdatedEvent;\n\n/**\n * Retrieves a bearer token from the `AuthenticationController` in\n * `@metamask/profile-sync-controller`. Declared structurally to avoid pulling\n * that package's transitive dependency tree in for a single action contract.\n */\ntype AuthenticationControllerGetBearerTokenAction = {\n type: 'AuthenticationController:getBearerToken';\n handler: (entropySourceId?: string) => Promise<string>;\n};\n\n/**\n * Actions from other messengers that {@link SentinelApiService} calls.\n */\ntype AllowedActions = AuthenticationControllerGetBearerTokenAction;\n\n/**\n * The messenger which is restricted to actions and events accessed by\n * {@link SentinelApiService}.\n */\nexport type SentinelApiServiceMessenger = Messenger<\n typeof serviceName,\n SentinelApiServiceActions | AllowedActions,\n SentinelApiServiceEvents\n>;\n\n/**\n * Constructor options for {@link SentinelApiService}.\n */\nexport type SentinelApiServiceOptions = {\n /** The messenger suited for this service. */\n messenger: SentinelApiServiceMessenger;\n\n /**\n * The `fetch` function to use for requests. Defaults to the global `fetch`.\n */\n fetch?: typeof fetch;\n\n /**\n * The Sentinel API environment to target (`dev`, `uat`, or `prod`).\n * Defaults to `prod`.\n */\n environment?: SentinelEnvironment;\n\n /**\n * Identifier for the calling client (for example `extension` or `mobile`),\n * sent as the `X-Client-Id` header.\n */\n clientId?: string;\n\n /**\n * Version of the calling client, sent as the `X-Client-Version` header when\n * provided.\n */\n clientVersion?: string;\n\n /** Configuration for the underlying TanStack Query client. */\n queryClientConfig?: QueryClientConfig;\n\n /**\n * Options to pass to `createServicePolicy`. Retries are disabled by default\n * (`maxRetries: 0`) to preserve the single-attempt behaviour of the clients\n * this service replaces; pass `maxRetries` here to opt in.\n */\n policyOptions?: CreateServicePolicyOptions;\n};\n\n/**\n * The feature that originated a relay (gas station) submission. Used purely as\n * metadata forwarded to the Sentinel API for observability. Redefined here so\n * that this package does not depend on `@metamask/smart-transactions-controller`.\n */\nexport enum SentinelFeature {\n Advanced = 'advanced',\n Default = 'default',\n Sponsored = 'sponsored',\n}\n\n/**\n * The kind of relay (gas station) submission. Redefined here so that this\n * package does not depend on `@metamask/smart-transactions-controller`.\n *\n * @deprecated Sentinel no longer takes a `kind` in its metadata. This enum\n * will be removed in a future major version.\n */\nexport enum SentinelKind {\n Bundle = 'bundle',\n Default = 'default',\n GaslessEIP7702 = 'gaslessEIP7702',\n GaslessSendBundle = 'gaslessSendBundle',\n}\n\nexport enum SentinelProductFeature {\n Bridge = 'Bridge',\n Card = 'Card',\n dAppTransaction = 'dAppTransaction',\n Earn = 'Earn',\n Perp = 'Perp',\n Prediction = 'Prediction',\n Ramp = 'Ramp',\n Staking = 'Staking',\n Swap = 'Swap',\n}\n\n/**\n * Optional metadata forwarded with a relay submission for observability. All\n * fields are optional and passed through verbatim to the Sentinel API.\n */\nexport type SentinelMeta = {\n client?: string;\n clientVersion?: string;\n feature?: SentinelFeature | SentinelProductFeature;\n\n /**\n * @deprecated Sentinel no longer takes a `kind` in its metadata. This field\n * will be removed in a future major version.\n */\n kind?: SentinelKind;\n origin?: string;\n txType?: string;\n\n /**\n * @deprecated Sentinel no longer takes a `wallet` in its metadata. This field\n * will be removed in a future major version.\n */\n wallet?: string;\n // Hardware wallet manufacturer. Omitted when the signer is not a hardware wallet.\n accountHardwareType?: string;\n};\n\n/**\n * An EIP-7702 authorization entry, as accepted by the Sentinel simulation API.\n */\nexport type SentinelAuthorization = {\n /** Address of the smart contract that contains the code to be set. */\n address: Hex;\n\n /** Address of the account being upgraded. */\n from: Hex;\n};\n\n/**\n * A single transaction to simulate in a Sentinel simulation request.\n */\nexport type SentinelSimulationTransaction = {\n /** EIP-7702 authorization list for the transaction. */\n authorizationList?: SentinelAuthorization[];\n\n /** Data to send with the transaction. */\n data?: Hex;\n\n /** Sender of the transaction. */\n from: Hex;\n\n /** Gas limit for the transaction. */\n gas?: Hex;\n\n /** Maximum fee per gas for the transaction. */\n maxFeePerGas?: Hex;\n\n /** Maximum priority fee per gas for the transaction. */\n maxPriorityFeePerGas?: Hex;\n\n /** Recipient of the transaction. */\n to?: Hex;\n\n /** Value to send with the transaction. */\n value?: Hex;\n};\n\n/**\n * Overrides to blockchain state, keyed by address, for a simulation request.\n */\nexport type SentinelStateOverrides = {\n [address: Hex]: {\n /** Override the native balance of an address. */\n balance?: Hex;\n\n /** Override the code for an address. */\n code?: Hex;\n\n /** Overrides to the storage slots for an address. */\n stateDiff?: {\n [slot: Hex]: Hex;\n };\n };\n};\n\n/**\n * A request to the Sentinel API to simulate transactions. This is the superset\n * of the shapes previously used by `@metamask/transaction-controller` and\n * `@metamask/transaction-pay-controller`.\n */\nexport type SentinelSimulationRequest = {\n /** Overrides to block data for the simulation. */\n blockOverrides?: {\n time?: Hex;\n };\n\n /** Overrides to blockchain state, keyed by address. */\n overrides?: SentinelStateOverrides;\n\n /** Whether to include available token fees in the response. */\n suggestFees?: {\n /** Whether the transaction is submitted via a delegation (EIP-7702). */\n with7702?: boolean;\n\n /** Whether to include the gas fee of the token transfer. */\n withFeeTransfer?: boolean;\n\n /**\n * Whether to include a RedeemerEnforcer caveat, restricting redemption to\n * the relay signers, in the delegation used for the EIP-7702 estimate.\n */\n withRedeemerEnforcer?: boolean;\n\n /** Whether to include the native transfer if available. */\n withTransfer?: boolean;\n };\n\n /**\n * Transactions to be sequentially simulated. State changes impact subsequent\n * transactions in the list.\n */\n transactions: SentinelSimulationTransaction[];\n\n /** Whether to include call traces in the response. Defaults to false. */\n withCallTrace?: boolean;\n\n /** Whether to include the default block data. Defaults to false. */\n withDefaultBlockOverrides?: boolean;\n\n /** Whether to use gas fees in the simulation. Defaults to false. */\n withGas?: boolean;\n\n /** Whether to include event logs in the response. Defaults to false. */\n withLogs?: boolean;\n};\n\n/**\n * A request to submit a signed relay (gas station) transaction to the Sentinel\n * API via `eth_sendRelayTransaction`.\n */\nexport type SentinelRelaySubmitRequest = {\n /** EIP-7702 authorization tuples for the delegation. */\n authorizationList?: SentinelSignedAuthorization[];\n\n /** The chain to submit the transaction on. */\n chainId: Hex;\n\n /** The encoded calldata (for example `redeemDelegations`). */\n data: Hex;\n\n /** Optional metadata forwarded to the API for observability. */\n metadata?: SentinelMeta;\n\n /** The recipient of the transaction (for example the DelegationManager). */\n to: Hex;\n};\n\n/**\n * A fully signed EIP-7702 authorization tuple, as submitted to the relay.\n */\nexport type SentinelSignedAuthorization = {\n address: Hex;\n chainId: Hex;\n nonce: Hex;\n r: Hex;\n s: Hex;\n yParity: Hex;\n};\n\n/**\n * A request to look up the state of a submitted smart transaction by UUID.\n */\nexport type SentinelSmartTransactionRequest = {\n /** The chain the transaction was submitted on. */\n chainId: Hex;\n\n /** The UUID returned by {@link SentinelRelaySubmitResponse}. */\n uuid: string;\n};\n\n/**\n * A request to quote gas fees for unsigned smart transactions via\n * `POST /v1/networks/{chainId}/getFees`.\n */\nexport type SentinelGetFeesRequest = {\n /** The chain to quote fees on. */\n chainId: Hex;\n\n /**\n * Transactions to quote, in the order the fees should be returned. Each\n * entry is a {@link SentinelSimulationTransaction}. The handler forwards\n * them as the `txs` array.\n */\n transactions: SentinelSimulationTransaction[];\n};\n\n/**\n * A raw signed smart transaction and the metadata stored with it.\n */\nexport type SentinelSubmitTransactionWithMetadata = {\n /** Raw signed transaction. */\n tx: Hex;\n\n /** Observability metadata stored with the transaction. */\n metadata?: SentinelMeta;\n};\n\n/**\n * A request to submit signed smart transactions via\n * `POST /v1/networks/{chainId}/submitTransactions`.\n */\nexport type SentinelSubmitTransactionsRequest = {\n /** The chain to submit the transactions on. */\n chainId: Hex;\n\n /**\n * Raw signed transactions. Used when `rawTxsWithMetadata` is omitted or\n * empty.\n */\n rawTxs: Hex[];\n\n /** Raw signed transactions that cancel the submitted batch. */\n rawCancelTxs?: Hex[];\n\n /**\n * Raw signed transactions with metadata. When non-empty, the API submits\n * these instead of `rawTxs`.\n */\n rawTxsWithMetadata?: SentinelSubmitTransactionWithMetadata[];\n};\n\n/**\n * A request to cancel a smart transaction via\n * `POST /v1/networks/{chainId}/cancel`.\n */\nexport type SentinelCancelRequest = {\n /** The chain to cancel the transaction on. */\n chainId: Hex;\n\n /** UUID of the smart transaction to cancel. */\n uuid: string;\n};\n\n/**\n * A request to look up smart-transaction statuses via\n * `GET /v1/networks/{chainId}/batchStatus`.\n */\nexport type SentinelBatchStatusRequest = {\n /** The chain to look up statuses on. */\n chainId: Hex;\n\n /**\n * UUIDs to look up. Sent as the comma-separated `uuids` query parameter.\n * The handler rejects a list longer than 128.\n */\n uuids: string[];\n};\n\n/**\n * A single network entry from the Sentinel `/networks` registry, or the\n * configuration of a single network from the `/network` endpoint.\n */\nexport type SentinelNetwork = {\n /** Raw field name from the Sentinel API response; note uppercase 'D'. */\n chainID?: number;\n\n /** Whether simulation (confirmations) is supported for this chain. */\n confirmations?: boolean;\n\n /** Addresses of the relay signers that submit relay transactions. */\n cubistSigners?: Hex[];\n\n /** The subdomain used to build the Sentinel URL for this chain. */\n network: string;\n\n /** Whether the gas station relay is supported for this chain. */\n relayTransactions?: boolean;\n\n /** Whether the bundle path is supported for this chain. */\n sendBundle?: boolean;\n\n /** Whether simulations on this chain include gas fees for native tokens. */\n simulationIncludeFees?: boolean;\n\n /** Whether smart transactions are supported for this chain. */\n smartTransactions?: boolean;\n};\n\n/**\n * The Sentinel `/networks` registry response, keyed by decimal chain ID.\n */\nexport type SentinelNetworkRegistry = Record<string, SentinelNetwork>;\n\n/**\n * Raw event log emitted by a simulated transaction.\n */\nexport type SentinelSimulationLog = {\n /** Address of the account that created the event. */\n address: Hex;\n\n /** Raw data in the event that is not indexed. */\n data: Hex;\n\n /** Raw indexed data from the event. */\n topics: Hex[];\n};\n\n/**\n * Call trace of a single simulated transaction.\n */\nexport type SentinelSimulationCallTrace = {\n /** Nested calls. */\n calls?: SentinelSimulationCallTrace[] | null;\n\n /** Error message for the call, if any. */\n error?: string;\n\n /** Raw event logs created by the call. */\n logs?: SentinelSimulationLog[] | null;\n\n /** Raw return data from the call (revert hex when reverted). */\n output?: Hex;\n};\n\n/**\n * Per-account state changes recorded by a simulated transaction.\n */\nexport type SentinelSimulationStateDiffAccount = {\n /** Native balance of the account. */\n balance?: Hex;\n\n /** Nonce of the account. */\n nonce?: Hex;\n\n /** Storage values per slot. */\n storage?: {\n [slot: Hex]: Hex;\n };\n};\n\n/**\n * Changes to the blockchain state (pre/post) for a single simulated\n * transaction. Each side is keyed by account address.\n */\nexport type SentinelSimulationStateDiff = {\n /** Initial blockchain state before the transaction. */\n pre?: {\n [address: Hex]: SentinelSimulationStateDiffAccount;\n };\n\n /** Updated blockchain state after the transaction. */\n post?: {\n [address: Hex]: SentinelSimulationStateDiffAccount;\n };\n};\n\n/**\n * A token-denominated fee option returned by the simulation API when\n * `suggestFees` is requested.\n */\nexport type SentinelSimulationTokenFee = {\n /** Amount of tokens needed to pay for gas. */\n balanceNeededToken: Hex;\n\n /** Current token balance of the sender. */\n currentBalanceToken: Hex;\n\n /** Account address that the token should be transferred to. */\n feeRecipient: Hex;\n\n /** Conversion rate of 1 token to native WEI. */\n rateWei: Hex;\n\n /** Portion of `balanceNeededToken` that is the fee paid to MetaMask. */\n serviceFee?: Hex;\n\n /** Token data independent of the current transaction. */\n token: {\n /** Address of the token contract. */\n address: Hex;\n\n /** Number of decimals used by the token. */\n decimals: number;\n\n /** Symbol of the token. */\n symbol: string;\n };\n\n /** Estimated gas limit required for the fee transfer. */\n transferEstimate: Hex;\n};\n\n/**\n * A single recommended fee level for a simulated transaction, including the\n * gas fee parameters and the token-fee options at that level.\n */\nexport type SentinelSimulationFeeLevel = {\n /** Gas limit for the fee level. */\n gas: Hex;\n\n /** Maximum fee per gas for the fee level. */\n maxFeePerGas: Hex;\n\n /** Maximum priority fee per gas for the fee level. */\n maxPriorityFeePerGas: Hex;\n\n /** Token fee options for the fee level. */\n tokenFees: SentinelSimulationTokenFee[];\n};\n\n/**\n * The result of simulating a single transaction.\n */\nexport type SentinelSimulationResponseTransaction = {\n /** Hierarchy of call data including nested calls and logs. */\n callTrace?: SentinelSimulationCallTrace;\n\n /** An error message indicating the transaction could not be simulated. */\n error?: string;\n\n /** Recommended gas fees for the transaction, per fee level. */\n fees?: SentinelSimulationFeeLevel[];\n\n /**\n * Estimated total gas cost of the transaction, in wei as a decimal number.\n * Included in the `stateDiff` when `withGas` is true.\n */\n gasCost?: number;\n\n /** Required `gasLimit` for the transaction. */\n gasLimit?: Hex;\n\n /** Total gas used by the transaction. */\n gasUsed?: Hex;\n\n /** Return value of the transaction (for example the balance from `balanceOf`). */\n return: Hex;\n\n /** Changes to the blockchain state produced by the transaction. */\n stateDiff?: SentinelSimulationStateDiff;\n};\n\n/**\n * The response from the Sentinel simulation API.\n */\nexport type SentinelSimulationResponse = {\n /** Sponsorship determination for the request. */\n sponsorship: {\n /** Whether the gas costs are sponsored (no transfer required). */\n isSponsored: boolean;\n\n /** Error message for the sponsorship determination, if any. */\n error: string | null;\n\n /** Name of the party paying the gas fee, such as `Uniswap` or `MetaMask`. */\n sponsor?: string;\n };\n\n /** Simulation data for each transaction in the request. */\n transactions: SentinelSimulationResponseTransaction[];\n};\n\n/**\n * The response from submitting a relay transaction.\n */\nexport type SentinelRelaySubmitResponse = {\n uuid: string;\n};\n\n/**\n * Terminal and non-terminal statuses reported by the smart-transactions\n * endpoint.\n */\nexport enum SentinelSmartTransactionStatus {\n Pending = 'PENDING',\n Validated = 'VALIDATED',\n Failed = 'FAILED',\n}\n\n/**\n * A single smart-transaction entry returned by the `/smart-transactions/{uuid}`\n * endpoint.\n */\nexport type SentinelSmartTransaction = {\n /** The on-chain transaction hash, once available. */\n hash?: string;\n\n /**\n * The current status of the smart transaction. Compare against\n * {@link SentinelSmartTransactionStatus} values.\n */\n status: string;\n\n /**\n * The reason the transaction failed, if any. May be `null` when the API\n * explicitly reports no error reason.\n */\n errorReason?: string | null;\n};\n\n/**\n * The response from the `/smart-transactions/{uuid}` endpoint. Consumers\n * select the transaction(s) they care about from the `transactions` array\n * (typically the first entry).\n */\nexport type SentinelSmartTransactionResponse = {\n transactions: SentinelSmartTransaction[];\n};\n\n/**\n * One gas-fee level returned by the smart-transactions `/getFees` endpoint.\n * Amounts are decimal numbers, in wei.\n */\nexport type SentinelSmartTransactionFee = {\n /** Maximum fee per gas, in wei. */\n maxFeePerGas: number;\n\n /** Maximum priority fee per gas, in wei. */\n maxPriorityFeePerGas: number;\n};\n\n/**\n * Fee quote for a single transaction from the `/getFees` endpoint.\n */\nexport type SentinelSmartTransactionFees = {\n /** Candidate fees for submitting the transaction. */\n fees: SentinelSmartTransactionFee[];\n\n /** Candidate fees for cancelling the transaction. */\n cancelFees: SentinelSmartTransactionFee[];\n\n /** Estimated total fee, in wei. */\n feeEstimate: number;\n\n /** Gas limit used for the quote. */\n gasLimit: number;\n\n /** Gas used by the quote. */\n gasUsed: number;\n};\n\n/**\n * The response from `POST /v1/networks/{chainId}/getFees`. One entry in `txs`\n * per transaction in the request, in the same order.\n */\nexport type SentinelGetFeesResponse = {\n txs: SentinelSmartTransactionFees[];\n};\n\n/**\n * The response from `POST /v1/networks/{chainId}/submitTransactions`.\n */\nexport type SentinelSubmitTransactionsResponse = {\n /** UUID assigned to the submitted batch. */\n uuid: string;\n};\n\n/**\n * The response from `POST /v1/networks/{chainId}/cancel`.\n */\nexport type SentinelCancelResponse = {\n /** UUID of the cancelled smart transaction. */\n uuid: string;\n\n /** Number of pending transactions the cancel updated. */\n affected: number;\n\n /**\n * Always `true` on a 200 response. The handler sets this itself; the RPC\n * result only carries `uuid` and `affected`.\n */\n cancelled: boolean;\n};\n\n/**\n * Values of `cancellationReason` on a batch-status entry.\n * Compliant with the Transaction API (SCP).\n */\nexport enum SentinelCancellationReason {\n DeadlineMissed = 'deadline_missed',\n InvalidNonce = 'invalid_nonce',\n NotCancelled = 'not_cancelled',\n TooCheap = 'too_cheap',\n UserCancelled = 'user_cancelled',\n WouldRevert = 'would_revert',\n}\n\n/**\n * Values of `minedTx` on a batch-status entry.\n * Compliant with the Transaction API (SCP).\n */\nexport enum SentinelMinedTxStatus {\n Cancelled = 'cancelled',\n NotMined = 'not_mined',\n Reverted = 'reverted',\n Success = 'success',\n}\n\n/**\n * Values of `originalTransactionStatus` on a batch-status entry.\n * `UNKNOWN_STATUS` is the Go `String()` fallback and is not produced for a\n * status loaded from the database.\n */\nexport enum SentinelOriginalTransactionStatus {\n Cancelled = 'CANCELLED',\n CancelledLeakedReverted = 'CANCELLED_LEAKED_REVERTED',\n CancelledLeakedValidated = 'CANCELLED_LEAKED_VALIDATED',\n Failed = 'FAILED',\n FailedAuth = 'FAILED_AUTH',\n FailedGaslessConfig = 'FAILED_GASLESS_CONFIG',\n FailedGasTooLow = 'FAILED_GAS_TOO_LOW',\n FailedInsufficientFee = 'FAILED_INSUFFICIENT_FEE',\n FailedInsufficientFunds = 'FAILED_INSUFFICIENT_FUNDS',\n FailedNonceTooHigh = 'FAILED_NONCE_TOO_HIGH',\n FailedSpam = 'FAILED_SPAM',\n FailedSponsorshipRule = 'FAILED_SPONSORSHIP_RULE',\n FailedTimeout = 'FAILED_TIMEOUT',\n FailedUnknown = 'FAILED_UNKNOWN',\n FailedWouldRevert = 'FAILED_WOULD_REVERT',\n LeakedReverted = 'LEAKED_REVERTED',\n LeakedValidated = 'LEAKED_VALIDATED',\n NonceTooLow = 'NONCE_TOO_LOW',\n Pending = 'PENDING',\n PendingCancelled = 'PENDING_CANCELLED',\n Reverted = 'REVERTED',\n Validated = 'VALIDATED',\n}\n\n/**\n * One UUID's status from `GET /v1/networks/{chainId}/batchStatus`.\n */\nexport type SentinelBatchedTransactionStatus = {\n /**\n * Cancellation fee in wei. The handler always sends `0`.\n */\n cancellationFeeWei: number;\n\n /** Why the transaction was cancelled, or `not_cancelled`. */\n cancellationReason: SentinelCancellationReason;\n\n /**\n * Deadline ratio. The handler always sends `0`.\n */\n deadlineRatio: number;\n\n /**\n * Whether the transaction has left `PENDING`. `PENDING_CANCELLED` is\n * settled.\n */\n isSettled: boolean;\n\n /**\n * Hash of the mined submission. Empty when the aggregate status is not a\n * mined status, or when no submission hash matches that status.\n */\n minedHash: string;\n\n /** Mining outcome of the smart transaction. */\n minedTx: SentinelMinedTxStatus;\n\n /**\n * Failure message. Empty unless the aggregate status is\n * `FAILED_WOULD_REVERT`, `FAILED_SPONSORSHIP_RULE`,\n * `FAILED_INSUFFICIENT_FUNDS`, or `FAILED_INSUFFICIENT_FEE`.\n */\n wouldRevertMessage: string;\n\n /** Whether Sentinel treated the submission as a duplicate. */\n duplicated: boolean;\n\n /** Whether the submission was proxied. */\n proxied: boolean;\n\n /** Whether the submission timed out. */\n timedOut: boolean;\n\n /** Aggregate smart-transaction status. */\n originalTransactionStatus: SentinelOriginalTransactionStatus;\n};\n\n/**\n * The response from `GET /v1/networks/{chainId}/batchStatus`.\n * Keys are the smart-transaction UUIDs from the request.\n */\nexport type SentinelBatchStatusResponse = Record<\n string,\n SentinelBatchedTransactionStatus\n>;\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA2EA;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,qBAAqB,EAAE,gCAAgC;CAC/C,CAAC;AA2FX;;;;GAIG;AACH,MAAM,CAAN,IAAY,eAI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,iCAuBX;AAvBD,WAAY,iCAAiC;IAC3C,4DAAuB,CAAA;IACvB,0FAAqD,CAAA;IACrD,4FAAuD,CAAA;IACvD,sDAAiB,CAAA;IACjB,+DAA0B,CAAA;IAC1B,kFAA6C,CAAA;IAC7C,2EAAsC,CAAA;IACtC,sFAAiD,CAAA;IACjD,0FAAqD,CAAA;IACrD,iFAA4C,CAAA;IAC5C,+DAA0B,CAAA;IAC1B,sFAAiD,CAAA;IACjD,qEAAgC,CAAA;IAChC,qEAAgC,CAAA;IAChC,8EAAyC,CAAA;IACzC,uEAAkC,CAAA;IAClC,yEAAoC,CAAA;IACpC,kEAA6B,CAAA;IAC7B,wDAAmB,CAAA;IACnB,2EAAsC,CAAA;IACtC,0DAAqB,CAAA;IACrB,4DAAuB,CAAA;AACzB,CAAC,EAvBW,iCAAiC,KAAjC,iCAAiC,QAuB5C","sourcesContent":["import type {\n DataServiceCacheUpdatedEvent,\n DataServiceGranularCacheUpdatedEvent,\n DataServiceInvalidateQueriesAction,\n} from '@metamask/base-data-service';\nimport type {\n CreateServicePolicyOptions,\n TraceContext,\n TraceRequest,\n} from '@metamask/controller-utils';\nimport type { Messenger } from '@metamask/messenger';\nimport type { Hex } from '@metamask/utils';\nimport type { QueryClientConfig } from '@tanstack/query-core';\n\nimport type { SentinelEnvironment, serviceName } from './constants.js';\nimport type { SentinelApiServiceMethodActions } from './sentinel-api-service-method-action-types.js';\n\n/**\n * Invalidates cached queries for {@link SentinelApiService}.\n */\nexport type SentinelApiServiceInvalidateQueriesAction =\n DataServiceInvalidateQueriesAction<typeof serviceName>;\n\n/**\n * Actions that {@link SentinelApiService} exposes to other consumers.\n */\nexport type SentinelApiServiceActions =\n | SentinelApiServiceMethodActions\n | SentinelApiServiceInvalidateQueriesAction;\n\n/**\n * Published when {@link SentinelApiService}'s cache is updated.\n */\nexport type SentinelApiServiceCacheUpdatedEvent = DataServiceCacheUpdatedEvent<\n typeof serviceName\n>;\n\n/**\n * Published when a key within {@link SentinelApiService}'s cache is updated.\n */\nexport type SentinelApiServiceGranularCacheUpdatedEvent =\n DataServiceGranularCacheUpdatedEvent<typeof serviceName>;\n\n/**\n * Events that {@link SentinelApiService} exposes to other consumers.\n */\nexport type SentinelApiServiceEvents =\n | SentinelApiServiceCacheUpdatedEvent\n | SentinelApiServiceGranularCacheUpdatedEvent;\n\n/**\n * Retrieves a bearer token from the `AuthenticationController` in\n * `@metamask/profile-sync-controller`. Declared structurally to avoid pulling\n * that package's transitive dependency tree in for a single action contract.\n */\ntype AuthenticationControllerGetBearerTokenAction = {\n type: 'AuthenticationController:getBearerToken';\n handler: (entropySourceId?: string) => Promise<string>;\n};\n\n/**\n * Actions from other messengers that {@link SentinelApiService} calls.\n */\ntype AllowedActions = AuthenticationControllerGetBearerTokenAction;\n\n/**\n * The messenger which is restricted to actions and events accessed by\n * {@link SentinelApiService}.\n */\nexport type SentinelApiServiceMessenger = Messenger<\n typeof serviceName,\n SentinelApiServiceActions | AllowedActions,\n SentinelApiServiceEvents\n>;\n\n/**\n * Names of operations {@link SentinelApiService} can trace.\n */\nexport const TRACES = {\n SIMULATE_TRANSACTIONS: 'Sentinel Simulate Transactions',\n} as const;\n\n/**\n * Name of an operation {@link SentinelApiService} can trace.\n */\nexport type SentinelApiServiceTraceName = (typeof TRACES)[keyof typeof TRACES];\n\n/**\n * Request passed to {@link SentinelApiServiceTraceCallback}.\n */\nexport type SentinelApiServiceTraceRequest = Omit<TraceRequest, 'name'> & {\n /** Name of the operation. */\n name: SentinelApiServiceTraceName;\n\n /**\n * Override the start time of the trace, in milliseconds.\n * Set by the service so a span recorded after the request can be backdated.\n */\n startTime?: number;\n};\n\n/**\n * Options accepted by traced {@link SentinelApiService} methods.\n */\nexport type SentinelApiServiceTraceOptions = {\n /**\n * Trace context to nest the operation's trace under. Without it, clients\n * that do not infer a parent from the active span record the trace as a\n * root span.\n */\n traceContext?: TraceContext;\n};\n\n/**\n * Callback that traces the performance of a Sentinel API operation.\n *\n * The service records the trace on a best-effort basis and does not fail the\n * request if tracing throws or rejects.\n */\nexport type SentinelApiServiceTraceCallback = <ReturnType>(\n request: SentinelApiServiceTraceRequest,\n fn?: (context?: TraceContext) => ReturnType,\n) => Promise<ReturnType>;\n\n/**\n * Constructor options for {@link SentinelApiService}.\n */\nexport type SentinelApiServiceOptions = {\n /** The messenger suited for this service. */\n messenger: SentinelApiServiceMessenger;\n\n /**\n * The `fetch` function to use for requests. Defaults to the global `fetch`.\n */\n fetch?: typeof fetch;\n\n /**\n * The Sentinel API environment to target (`dev`, `uat`, or `prod`).\n * Defaults to `prod`.\n */\n environment?: SentinelEnvironment;\n\n /**\n * Identifier for the calling client (for example `extension` or `mobile`),\n * sent as the `X-Client-Id` header.\n */\n clientId?: string;\n\n /**\n * Version of the calling client, sent as the `X-Client-Version` header when\n * provided.\n */\n clientVersion?: string;\n\n /** Configuration for the underlying TanStack Query client. */\n queryClientConfig?: QueryClientConfig;\n\n /**\n * Options to pass to `createServicePolicy`. Retries are disabled by default\n * (`maxRetries: 0`) to preserve the single-attempt behaviour of the clients\n * this service replaces; pass `maxRetries` here to opt in.\n */\n policyOptions?: CreateServicePolicyOptions;\n\n /**\n * Optional callback to trace network requests. Tracing is best-effort and\n * does not affect the request result if it fails.\n */\n trace?: SentinelApiServiceTraceCallback;\n};\n\n/**\n * The feature that originated a relay (gas station) submission. Used purely as\n * metadata forwarded to the Sentinel API for observability. Redefined here so\n * that this package does not depend on `@metamask/smart-transactions-controller`.\n */\nexport enum SentinelFeature {\n Advanced = 'advanced',\n Default = 'default',\n Sponsored = 'sponsored',\n}\n\n/**\n * The kind of relay (gas station) submission. Redefined here so that this\n * package does not depend on `@metamask/smart-transactions-controller`.\n *\n * @deprecated Sentinel no longer takes a `kind` in its metadata. This enum\n * will be removed in a future major version.\n */\nexport enum SentinelKind {\n Bundle = 'bundle',\n Default = 'default',\n GaslessEIP7702 = 'gaslessEIP7702',\n GaslessSendBundle = 'gaslessSendBundle',\n}\n\nexport enum SentinelProductFeature {\n Bridge = 'Bridge',\n Card = 'Card',\n dAppTransaction = 'dAppTransaction',\n Earn = 'Earn',\n Perp = 'Perp',\n Prediction = 'Prediction',\n Ramp = 'Ramp',\n Staking = 'Staking',\n Swap = 'Swap',\n}\n\n/**\n * Optional metadata forwarded with a relay submission for observability. All\n * fields are optional and passed through verbatim to the Sentinel API.\n */\nexport type SentinelMeta = {\n client?: string;\n clientVersion?: string;\n feature?: SentinelFeature | SentinelProductFeature;\n\n /**\n * @deprecated Sentinel no longer takes a `kind` in its metadata. This field\n * will be removed in a future major version.\n */\n kind?: SentinelKind;\n origin?: string;\n txType?: string;\n\n /**\n * @deprecated Sentinel no longer takes a `wallet` in its metadata. This field\n * will be removed in a future major version.\n */\n wallet?: string;\n // Hardware wallet manufacturer. Omitted when the signer is not a hardware wallet.\n accountHardwareType?: string;\n};\n\n/**\n * An EIP-7702 authorization entry, as accepted by the Sentinel simulation API.\n */\nexport type SentinelAuthorization = {\n /** Address of the smart contract that contains the code to be set. */\n address: Hex;\n\n /** Address of the account being upgraded. */\n from: Hex;\n};\n\n/**\n * A single transaction to simulate in a Sentinel simulation request.\n */\nexport type SentinelSimulationTransaction = {\n /** EIP-7702 authorization list for the transaction. */\n authorizationList?: SentinelAuthorization[];\n\n /** Data to send with the transaction. */\n data?: Hex;\n\n /** Sender of the transaction. */\n from: Hex;\n\n /** Gas limit for the transaction. */\n gas?: Hex;\n\n /** Maximum fee per gas for the transaction. */\n maxFeePerGas?: Hex;\n\n /** Maximum priority fee per gas for the transaction. */\n maxPriorityFeePerGas?: Hex;\n\n /** Recipient of the transaction. */\n to?: Hex;\n\n /** Value to send with the transaction. */\n value?: Hex;\n};\n\n/**\n * Overrides to blockchain state, keyed by address, for a simulation request.\n */\nexport type SentinelStateOverrides = {\n [address: Hex]: {\n /** Override the native balance of an address. */\n balance?: Hex;\n\n /** Override the code for an address. */\n code?: Hex;\n\n /** Overrides to the storage slots for an address. */\n stateDiff?: {\n [slot: Hex]: Hex;\n };\n };\n};\n\n/**\n * A request to the Sentinel API to simulate transactions. This is the superset\n * of the shapes previously used by `@metamask/transaction-controller` and\n * `@metamask/transaction-pay-controller`.\n */\nexport type SentinelSimulationRequest = {\n /** Overrides to block data for the simulation. */\n blockOverrides?: {\n time?: Hex;\n };\n\n /** Overrides to blockchain state, keyed by address. */\n overrides?: SentinelStateOverrides;\n\n /** Whether to include available token fees in the response. */\n suggestFees?: {\n /** Whether the transaction is submitted via a delegation (EIP-7702). */\n with7702?: boolean;\n\n /** Whether to include the gas fee of the token transfer. */\n withFeeTransfer?: boolean;\n\n /**\n * Whether to include a RedeemerEnforcer caveat, restricting redemption to\n * the relay signers, in the delegation used for the EIP-7702 estimate.\n */\n withRedeemerEnforcer?: boolean;\n\n /** Whether to include the native transfer if available. */\n withTransfer?: boolean;\n };\n\n /**\n * Transactions to be sequentially simulated. State changes impact subsequent\n * transactions in the list.\n */\n transactions: SentinelSimulationTransaction[];\n\n /** Whether to include call traces in the response. Defaults to false. */\n withCallTrace?: boolean;\n\n /** Whether to include the default block data. Defaults to false. */\n withDefaultBlockOverrides?: boolean;\n\n /** Whether to use gas fees in the simulation. Defaults to false. */\n withGas?: boolean;\n\n /** Whether to include event logs in the response. Defaults to false. */\n withLogs?: boolean;\n};\n\n/**\n * A request to submit a signed relay (gas station) transaction to the Sentinel\n * API via `eth_sendRelayTransaction`.\n */\nexport type SentinelRelaySubmitRequest = {\n /** EIP-7702 authorization tuples for the delegation. */\n authorizationList?: SentinelSignedAuthorization[];\n\n /** The chain to submit the transaction on. */\n chainId: Hex;\n\n /** The encoded calldata (for example `redeemDelegations`). */\n data: Hex;\n\n /** Optional metadata forwarded to the API for observability. */\n metadata?: SentinelMeta;\n\n /** The recipient of the transaction (for example the DelegationManager). */\n to: Hex;\n};\n\n/**\n * A fully signed EIP-7702 authorization tuple, as submitted to the relay.\n */\nexport type SentinelSignedAuthorization = {\n address: Hex;\n chainId: Hex;\n nonce: Hex;\n r: Hex;\n s: Hex;\n yParity: Hex;\n};\n\n/**\n * A request to look up the state of a submitted smart transaction by UUID.\n */\nexport type SentinelSmartTransactionRequest = {\n /** The chain the transaction was submitted on. */\n chainId: Hex;\n\n /** The UUID returned by {@link SentinelRelaySubmitResponse}. */\n uuid: string;\n};\n\n/**\n * A request to quote gas fees for unsigned smart transactions via\n * `POST /v1/networks/{chainId}/getFees`.\n */\nexport type SentinelGetFeesRequest = {\n /** The chain to quote fees on. */\n chainId: Hex;\n\n /**\n * Transactions to quote, in the order the fees should be returned. Each\n * entry is a {@link SentinelSimulationTransaction}. The handler forwards\n * them as the `txs` array.\n */\n transactions: SentinelSimulationTransaction[];\n};\n\n/**\n * A raw signed smart transaction and the metadata stored with it.\n */\nexport type SentinelSubmitTransactionWithMetadata = {\n /** Raw signed transaction. */\n tx: Hex;\n\n /** Observability metadata stored with the transaction. */\n metadata?: SentinelMeta;\n};\n\n/**\n * A request to submit signed smart transactions via\n * `POST /v1/networks/{chainId}/submitTransactions`.\n */\nexport type SentinelSubmitTransactionsRequest = {\n /** The chain to submit the transactions on. */\n chainId: Hex;\n\n /**\n * Raw signed transactions. Used when `rawTxsWithMetadata` is omitted or\n * empty.\n */\n rawTxs: Hex[];\n\n /** Raw signed transactions that cancel the submitted batch. */\n rawCancelTxs?: Hex[];\n\n /**\n * Raw signed transactions with metadata. When non-empty, the API submits\n * these instead of `rawTxs`.\n */\n rawTxsWithMetadata?: SentinelSubmitTransactionWithMetadata[];\n};\n\n/**\n * A request to cancel a smart transaction via\n * `POST /v1/networks/{chainId}/cancel`.\n */\nexport type SentinelCancelRequest = {\n /** The chain to cancel the transaction on. */\n chainId: Hex;\n\n /** UUID of the smart transaction to cancel. */\n uuid: string;\n};\n\n/**\n * A request to look up smart-transaction statuses via\n * `GET /v1/networks/{chainId}/batchStatus`.\n */\nexport type SentinelBatchStatusRequest = {\n /** The chain to look up statuses on. */\n chainId: Hex;\n\n /**\n * UUIDs to look up. Sent as the comma-separated `uuids` query parameter.\n * The handler rejects a list longer than 128.\n */\n uuids: string[];\n};\n\n/**\n * A single network entry from the Sentinel `/networks` registry, or the\n * configuration of a single network from the `/network` endpoint.\n */\nexport type SentinelNetwork = {\n /** Raw field name from the Sentinel API response; note uppercase 'D'. */\n chainID?: number;\n\n /** Whether simulation (confirmations) is supported for this chain. */\n confirmations?: boolean;\n\n /** Addresses of the relay signers that submit relay transactions. */\n cubistSigners?: Hex[];\n\n /** The subdomain used to build the Sentinel URL for this chain. */\n network: string;\n\n /** Whether the gas station relay is supported for this chain. */\n relayTransactions?: boolean;\n\n /** Whether the bundle path is supported for this chain. */\n sendBundle?: boolean;\n\n /** Whether simulations on this chain include gas fees for native tokens. */\n simulationIncludeFees?: boolean;\n\n /** Whether smart transactions are supported for this chain. */\n smartTransactions?: boolean;\n};\n\n/**\n * The Sentinel `/networks` registry response, keyed by decimal chain ID.\n */\nexport type SentinelNetworkRegistry = Record<string, SentinelNetwork>;\n\n/**\n * Raw event log emitted by a simulated transaction.\n */\nexport type SentinelSimulationLog = {\n /** Address of the account that created the event. */\n address: Hex;\n\n /** Raw data in the event that is not indexed. */\n data: Hex;\n\n /** Raw indexed data from the event. */\n topics: Hex[];\n};\n\n/**\n * Call trace of a single simulated transaction.\n */\nexport type SentinelSimulationCallTrace = {\n /** Nested calls. */\n calls?: SentinelSimulationCallTrace[] | null;\n\n /** Error message for the call, if any. */\n error?: string;\n\n /** Raw event logs created by the call. */\n logs?: SentinelSimulationLog[] | null;\n\n /** Raw return data from the call (revert hex when reverted). */\n output?: Hex;\n};\n\n/**\n * Per-account state changes recorded by a simulated transaction.\n */\nexport type SentinelSimulationStateDiffAccount = {\n /** Native balance of the account. */\n balance?: Hex;\n\n /** Nonce of the account. */\n nonce?: Hex;\n\n /** Storage values per slot. */\n storage?: {\n [slot: Hex]: Hex;\n };\n};\n\n/**\n * Changes to the blockchain state (pre/post) for a single simulated\n * transaction. Each side is keyed by account address.\n */\nexport type SentinelSimulationStateDiff = {\n /** Initial blockchain state before the transaction. */\n pre?: {\n [address: Hex]: SentinelSimulationStateDiffAccount;\n };\n\n /** Updated blockchain state after the transaction. */\n post?: {\n [address: Hex]: SentinelSimulationStateDiffAccount;\n };\n};\n\n/**\n * A token-denominated fee option returned by the simulation API when\n * `suggestFees` is requested.\n */\nexport type SentinelSimulationTokenFee = {\n /** Amount of tokens needed to pay for gas. */\n balanceNeededToken: Hex;\n\n /** Current token balance of the sender. */\n currentBalanceToken: Hex;\n\n /** Account address that the token should be transferred to. */\n feeRecipient: Hex;\n\n /** Conversion rate of 1 token to native WEI. */\n rateWei: Hex;\n\n /** Portion of `balanceNeededToken` that is the fee paid to MetaMask. */\n serviceFee?: Hex;\n\n /** Token data independent of the current transaction. */\n token: {\n /** Address of the token contract. */\n address: Hex;\n\n /** Number of decimals used by the token. */\n decimals: number;\n\n /** Symbol of the token. */\n symbol: string;\n };\n\n /** Estimated gas limit required for the fee transfer. */\n transferEstimate: Hex;\n};\n\n/**\n * A single recommended fee level for a simulated transaction, including the\n * gas fee parameters and the token-fee options at that level.\n */\nexport type SentinelSimulationFeeLevel = {\n /** Gas limit for the fee level. */\n gas: Hex;\n\n /** Maximum fee per gas for the fee level. */\n maxFeePerGas: Hex;\n\n /** Maximum priority fee per gas for the fee level. */\n maxPriorityFeePerGas: Hex;\n\n /** Token fee options for the fee level. */\n tokenFees: SentinelSimulationTokenFee[];\n};\n\n/**\n * The result of simulating a single transaction.\n */\nexport type SentinelSimulationResponseTransaction = {\n /** Hierarchy of call data including nested calls and logs. */\n callTrace?: SentinelSimulationCallTrace;\n\n /** An error message indicating the transaction could not be simulated. */\n error?: string;\n\n /** Recommended gas fees for the transaction, per fee level. */\n fees?: SentinelSimulationFeeLevel[];\n\n /**\n * Estimated total gas cost of the transaction, in wei as a decimal number.\n * Included in the `stateDiff` when `withGas` is true.\n */\n gasCost?: number;\n\n /** Required `gasLimit` for the transaction. */\n gasLimit?: Hex;\n\n /** Total gas used by the transaction. */\n gasUsed?: Hex;\n\n /** Return value of the transaction (for example the balance from `balanceOf`). */\n return: Hex;\n\n /** Changes to the blockchain state produced by the transaction. */\n stateDiff?: SentinelSimulationStateDiff;\n};\n\n/**\n * The response from the Sentinel simulation API.\n */\nexport type SentinelSimulationResponse = {\n /** Sponsorship determination for the request. */\n sponsorship: {\n /** Whether the gas costs are sponsored (no transfer required). */\n isSponsored: boolean;\n\n /** Error message for the sponsorship determination, if any. */\n error: string | null;\n\n /** Name of the party paying the gas fee, such as `Uniswap` or `MetaMask`. */\n sponsor?: string;\n };\n\n /** Simulation data for each transaction in the request. */\n transactions: SentinelSimulationResponseTransaction[];\n};\n\n/**\n * The response from submitting a relay transaction.\n */\nexport type SentinelRelaySubmitResponse = {\n uuid: string;\n};\n\n/**\n * Terminal and non-terminal statuses reported by the smart-transactions\n * endpoint.\n */\nexport enum SentinelSmartTransactionStatus {\n Pending = 'PENDING',\n Validated = 'VALIDATED',\n Failed = 'FAILED',\n}\n\n/**\n * A single smart-transaction entry returned by the `/smart-transactions/{uuid}`\n * endpoint.\n */\nexport type SentinelSmartTransaction = {\n /** The on-chain transaction hash, once available. */\n hash?: string;\n\n /**\n * The current status of the smart transaction. Compare against\n * {@link SentinelSmartTransactionStatus} values.\n */\n status: string;\n\n /**\n * The reason the transaction failed, if any. May be `null` when the API\n * explicitly reports no error reason.\n */\n errorReason?: string | null;\n};\n\n/**\n * The response from the `/smart-transactions/{uuid}` endpoint. Consumers\n * select the transaction(s) they care about from the `transactions` array\n * (typically the first entry).\n */\nexport type SentinelSmartTransactionResponse = {\n transactions: SentinelSmartTransaction[];\n};\n\n/**\n * One gas-fee level returned by the smart-transactions `/getFees` endpoint.\n * Amounts are decimal numbers, in wei.\n */\nexport type SentinelSmartTransactionFee = {\n /** Maximum fee per gas, in wei. */\n maxFeePerGas: number;\n\n /** Maximum priority fee per gas, in wei. */\n maxPriorityFeePerGas: number;\n};\n\n/**\n * Fee quote for a single transaction from the `/getFees` endpoint.\n */\nexport type SentinelSmartTransactionFees = {\n /** Candidate fees for submitting the transaction. */\n fees: SentinelSmartTransactionFee[];\n\n /** Candidate fees for cancelling the transaction. */\n cancelFees: SentinelSmartTransactionFee[];\n\n /** Estimated total fee, in wei. */\n feeEstimate: number;\n\n /** Gas limit used for the quote. */\n gasLimit: number;\n\n /** Gas used by the quote. */\n gasUsed: number;\n};\n\n/**\n * The response from `POST /v1/networks/{chainId}/getFees`. One entry in `txs`\n * per transaction in the request, in the same order.\n */\nexport type SentinelGetFeesResponse = {\n txs: SentinelSmartTransactionFees[];\n};\n\n/**\n * The response from `POST /v1/networks/{chainId}/submitTransactions`.\n */\nexport type SentinelSubmitTransactionsResponse = {\n /** UUID assigned to the submitted batch. */\n uuid: string;\n};\n\n/**\n * The response from `POST /v1/networks/{chainId}/cancel`.\n */\nexport type SentinelCancelResponse = {\n /** UUID of the cancelled smart transaction. */\n uuid: string;\n\n /** Number of pending transactions the cancel updated. */\n affected: number;\n\n /**\n * Always `true` on a 200 response. The handler sets this itself; the RPC\n * result only carries `uuid` and `affected`.\n */\n cancelled: boolean;\n};\n\n/**\n * Values of `cancellationReason` on a batch-status entry.\n * Compliant with the Transaction API (SCP).\n */\nexport enum SentinelCancellationReason {\n DeadlineMissed = 'deadline_missed',\n InvalidNonce = 'invalid_nonce',\n NotCancelled = 'not_cancelled',\n TooCheap = 'too_cheap',\n UserCancelled = 'user_cancelled',\n WouldRevert = 'would_revert',\n}\n\n/**\n * Values of `minedTx` on a batch-status entry.\n * Compliant with the Transaction API (SCP).\n */\nexport enum SentinelMinedTxStatus {\n Cancelled = 'cancelled',\n NotMined = 'not_mined',\n Reverted = 'reverted',\n Success = 'success',\n}\n\n/**\n * Values of `originalTransactionStatus` on a batch-status entry.\n * `UNKNOWN_STATUS` is the Go `String()` fallback and is not produced for a\n * status loaded from the database.\n */\nexport enum SentinelOriginalTransactionStatus {\n Cancelled = 'CANCELLED',\n CancelledLeakedReverted = 'CANCELLED_LEAKED_REVERTED',\n CancelledLeakedValidated = 'CANCELLED_LEAKED_VALIDATED',\n Failed = 'FAILED',\n FailedAuth = 'FAILED_AUTH',\n FailedGaslessConfig = 'FAILED_GASLESS_CONFIG',\n FailedGasTooLow = 'FAILED_GAS_TOO_LOW',\n FailedInsufficientFee = 'FAILED_INSUFFICIENT_FEE',\n FailedInsufficientFunds = 'FAILED_INSUFFICIENT_FUNDS',\n FailedNonceTooHigh = 'FAILED_NONCE_TOO_HIGH',\n FailedSpam = 'FAILED_SPAM',\n FailedSponsorshipRule = 'FAILED_SPONSORSHIP_RULE',\n FailedTimeout = 'FAILED_TIMEOUT',\n FailedUnknown = 'FAILED_UNKNOWN',\n FailedWouldRevert = 'FAILED_WOULD_REVERT',\n LeakedReverted = 'LEAKED_REVERTED',\n LeakedValidated = 'LEAKED_VALIDATED',\n NonceTooLow = 'NONCE_TOO_LOW',\n Pending = 'PENDING',\n PendingCancelled = 'PENDING_CANCELLED',\n Reverted = 'REVERTED',\n Validated = 'VALIDATED',\n}\n\n/**\n * One UUID's status from `GET /v1/networks/{chainId}/batchStatus`.\n */\nexport type SentinelBatchedTransactionStatus = {\n /**\n * Cancellation fee in wei. The handler always sends `0`.\n */\n cancellationFeeWei: number;\n\n /** Why the transaction was cancelled, or `not_cancelled`. */\n cancellationReason: SentinelCancellationReason;\n\n /**\n * Deadline ratio. The handler always sends `0`.\n */\n deadlineRatio: number;\n\n /**\n * Whether the transaction has left `PENDING`. `PENDING_CANCELLED` is\n * settled.\n */\n isSettled: boolean;\n\n /**\n * Hash of the mined submission. Empty when the aggregate status is not a\n * mined status, or when no submission hash matches that status.\n */\n minedHash: string;\n\n /** Mining outcome of the smart transaction. */\n minedTx: SentinelMinedTxStatus;\n\n /**\n * Failure message. Empty unless the aggregate status is\n * `FAILED_WOULD_REVERT`, `FAILED_SPONSORSHIP_RULE`,\n * `FAILED_INSUFFICIENT_FUNDS`, or `FAILED_INSUFFICIENT_FEE`.\n */\n wouldRevertMessage: string;\n\n /** Whether Sentinel treated the submission as a duplicate. */\n duplicated: boolean;\n\n /** Whether the submission was proxied. */\n proxied: boolean;\n\n /** Whether the submission timed out. */\n timedOut: boolean;\n\n /** Aggregate smart-transaction status. */\n originalTransactionStatus: SentinelOriginalTransactionStatus;\n};\n\n/**\n * The response from `GET /v1/networks/{chainId}/batchStatus`.\n * Keys are the smart-transaction UUIDs from the request.\n */\nexport type SentinelBatchStatusResponse = Record<\n string,\n SentinelBatchedTransactionStatus\n>;\n"]}
|