@metamask-previews/sentinel-api-service 2.0.0-preview-1a7a6d6d6 → 2.0.0-preview-cbae429b5

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 CHANGED
@@ -7,13 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ### Added
11
-
12
- - Add `getNetwork` method and `SentinelApiService:getNetwork` action to retrieve the configuration of a single network from the `/network` endpoint ([#10676](https://github.com/MetaMask/core/pull/10676))
13
- - Responses are cached for 5 minutes per chain.
14
- - Throws `SentinelChainNotSupportedError` if the chain is not in the supported-network registry.
15
- - Add `cubistSigners` and `simulationIncludeFees` properties to the `SentinelNetwork` type.
16
-
17
10
  ### Changed
18
11
 
19
12
  - Bump `@metamask/utils` from `^11.12.0` to `^12.0.0` ([#10192](https://github.com/MetaMask/core/pull/10192))
@@ -46,11 +46,6 @@ export declare const DEFAULT_ENVIRONMENT = SentinelEnvironment.Prod;
46
46
  * returns identical data regardless of subdomain, so a stable one is used.
47
47
  */
48
48
  export declare const NETWORKS_SUBDOMAIN = "ethereum-mainnet";
49
- /**
50
- * The REST path used to retrieve the configuration of a single network. Must
51
- * be requested against the subdomain of the network in question.
52
- */
53
- export declare const ENDPOINT_NETWORK = "network";
54
49
  /**
55
50
  * The REST path used to retrieve the supported-network registry.
56
51
  */
@@ -60,12 +55,6 @@ export declare const ENDPOINT_NETWORKS = "networks";
60
55
  * transaction by UUID.
61
56
  */
62
57
  export declare const ENDPOINT_SMART_TRANSACTIONS = "smart-transactions";
63
- /**
64
- * How long the single network configuration (`/network`) response is
65
- * considered fresh. The configuration is stable, so caching it avoids
66
- * re-fetching on every request.
67
- */
68
- export declare const NETWORK_STALE_TIME_MS: number;
69
58
  /**
70
59
  * How long the network registry (`/networks`) response is considered fresh.
71
60
  * The registry is stable, so caching it avoids re-fetching on every request.
@@ -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;IAC1D,GAAG,QAAQ;IACX,sEAAsE;IACtE,GAAG,QAAQ;IACX,qDAAqD;IACrD,IAAI,SAAS;CACd;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAIlE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,kBAAkB,qBAAqB,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,iBAAiB,aAAa,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,QAAgB,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAAgB,CAAC"}
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;IAC1D,GAAG,QAAQ;IACX,sEAAsE;IACtE,GAAG,QAAQ;IACX,qDAAqD;IACrD,IAAI,SAAS;CACd;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAIlE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,kBAAkB,qBAAqB,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,iBAAiB,aAAa,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAAgB,CAAC"}
package/dist/constants.js CHANGED
@@ -51,11 +51,6 @@ export const DEFAULT_ENVIRONMENT = SentinelEnvironment.Prod;
51
51
  * returns identical data regardless of subdomain, so a stable one is used.
52
52
  */
53
53
  export const NETWORKS_SUBDOMAIN = 'ethereum-mainnet';
54
- /**
55
- * The REST path used to retrieve the configuration of a single network. Must
56
- * be requested against the subdomain of the network in question.
57
- */
58
- export const ENDPOINT_NETWORK = 'network';
59
54
  /**
60
55
  * The REST path used to retrieve the supported-network registry.
61
56
  */
@@ -65,12 +60,6 @@ export const ENDPOINT_NETWORKS = 'networks';
65
60
  * transaction by UUID.
66
61
  */
67
62
  export const ENDPOINT_SMART_TRANSACTIONS = 'smart-transactions';
68
- /**
69
- * How long the single network configuration (`/network`) response is
70
- * considered fresh. The configuration is stable, so caching it avoids
71
- * re-fetching on every request.
72
- */
73
- export const NETWORK_STALE_TIME_MS = 5 * 60 * 1000;
74
63
  /**
75
64
  * How long the network registry (`/networks`) response is considered fresh.
76
65
  * The registry is stable, so caching it avoids re-fetching on every request.
@@ -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,mBAAmB,QAO9B;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAwC;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,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnD;;;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. The configuration is stable, so caching it avoids\n * re-fetching on every request.\n */\nexport const NETWORK_STALE_TIME_MS = 5 * 60 * 1000;\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"]}
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,mBAAmB,QAO9B;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAwC;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;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,oBAAoB,CAAC;AAEhE;;;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 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 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
@@ -2,6 +2,6 @@ export { SentinelApiService } from './sentinel-api-service.js';
2
2
  export { SentinelEnvironment, serviceName } from './constants.js';
3
3
  export type { SentinelApiServiceActions, SentinelApiServiceEvents, SentinelApiServiceMessenger, SentinelApiServiceOptions, SentinelApiServiceInvalidateQueriesAction, SentinelApiServiceCacheUpdatedEvent, SentinelApiServiceGranularCacheUpdatedEvent, SentinelAuthorization, SentinelMeta, SentinelNetwork, SentinelNetworkRegistry, SentinelRelaySubmitRequest, SentinelRelaySubmitResponse, SentinelSignedAuthorization, SentinelSimulationCallTrace, SentinelSimulationLog, SentinelSimulationRequest, SentinelSimulationResponse, SentinelSimulationResponseTransaction, SentinelSimulationStateDiff, SentinelSimulationTokenFee, SentinelSimulationTransaction, SentinelSmartTransaction, SentinelSmartTransactionRequest, SentinelSmartTransactionResponse, SentinelStateOverrides, } from './types.js';
4
4
  export { SentinelFeature, SentinelKind, SentinelSmartTransactionStatus, } from './types.js';
5
- export type { SentinelApiServiceGetNetworkAction, SentinelApiServiceGetNetworksAction, SentinelApiServiceSimulateTransactionsAction, SentinelApiServiceSubmitRelayTransactionAction, SentinelApiServiceGetSmartTransactionAction, } from './sentinel-api-service-method-action-types.js';
5
+ export type { SentinelApiServiceGetNetworksAction, SentinelApiServiceSimulateTransactionsAction, SentinelApiServiceSubmitRelayTransactionAction, SentinelApiServiceGetSmartTransactionAction, } from './sentinel-api-service-method-action-types.js';
6
6
  export { SentinelApiResponseValidationError, SentinelChainNotSupportedError, SentinelJsonRpcError, } from './errors.js';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -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,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,2BAA2B,EAC3B,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,qCAAqC,EACrC,2BAA2B,EAC3B,0BAA0B,EAC1B,6BAA6B,EAC7B,wBAAwB,EACxB,+BAA+B,EAC/B,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,YAAY,EACZ,8BAA8B,GAC/B,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,kCAAkC,EAClC,mCAAmC,EACnC,4CAA4C,EAC5C,8CAA8C,EAC9C,2CAA2C,GAC5C,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,kCAAkC,EAClC,8BAA8B,EAC9B,oBAAoB,GACrB,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClE,YAAY,EACV,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,yCAAyC,EACzC,mCAAmC,EACnC,2CAA2C,EAC3C,qBAAqB,EACrB,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,2BAA2B,EAC3B,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,qCAAqC,EACrC,2BAA2B,EAC3B,0BAA0B,EAC1B,6BAA6B,EAC7B,wBAAwB,EACxB,+BAA+B,EAC/B,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,YAAY,EACZ,8BAA8B,GAC/B,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,mCAAmC,EACnC,4CAA4C,EAC5C,8CAA8C,EAC9C,2CAA2C,GAC5C,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,kCAAkC,EAClC,8BAA8B,EAC9B,oBAAoB,GACrB,MAAM,aAAa,CAAC"}
package/dist/index.js.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;AA6BlE,OAAO,EACL,eAAe,EACf,YAAY,EACZ,8BAA8B,GAC/B,MAAM,YAAY,CAAC;AAQpB,OAAO,EACL,kCAAkC,EAClC,8BAA8B,EAC9B,oBAAoB,GACrB,MAAM,aAAa,CAAC","sourcesContent":["export { SentinelApiService } from './sentinel-api-service.js';\nexport { SentinelEnvironment, serviceName } from './constants.js';\nexport type {\n SentinelApiServiceActions,\n SentinelApiServiceEvents,\n SentinelApiServiceMessenger,\n SentinelApiServiceOptions,\n SentinelApiServiceInvalidateQueriesAction,\n SentinelApiServiceCacheUpdatedEvent,\n SentinelApiServiceGranularCacheUpdatedEvent,\n SentinelAuthorization,\n SentinelMeta,\n SentinelNetwork,\n SentinelNetworkRegistry,\n SentinelRelaySubmitRequest,\n SentinelRelaySubmitResponse,\n SentinelSignedAuthorization,\n SentinelSimulationCallTrace,\n SentinelSimulationLog,\n SentinelSimulationRequest,\n SentinelSimulationResponse,\n SentinelSimulationResponseTransaction,\n SentinelSimulationStateDiff,\n SentinelSimulationTokenFee,\n SentinelSimulationTransaction,\n SentinelSmartTransaction,\n SentinelSmartTransactionRequest,\n SentinelSmartTransactionResponse,\n SentinelStateOverrides,\n} from './types.js';\nexport {\n SentinelFeature,\n SentinelKind,\n SentinelSmartTransactionStatus,\n} from './types.js';\nexport type {\n SentinelApiServiceGetNetworkAction,\n SentinelApiServiceGetNetworksAction,\n SentinelApiServiceSimulateTransactionsAction,\n SentinelApiServiceSubmitRelayTransactionAction,\n SentinelApiServiceGetSmartTransactionAction,\n} from './sentinel-api-service-method-action-types.js';\nexport {\n SentinelApiResponseValidationError,\n SentinelChainNotSupportedError,\n SentinelJsonRpcError,\n} from './errors.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA6BlE,OAAO,EACL,eAAe,EACf,YAAY,EACZ,8BAA8B,GAC/B,MAAM,YAAY,CAAC;AAOpB,OAAO,EACL,kCAAkC,EAClC,8BAA8B,EAC9B,oBAAoB,GACrB,MAAM,aAAa,CAAC","sourcesContent":["export { SentinelApiService } from './sentinel-api-service.js';\nexport { SentinelEnvironment, serviceName } from './constants.js';\nexport type {\n SentinelApiServiceActions,\n SentinelApiServiceEvents,\n SentinelApiServiceMessenger,\n SentinelApiServiceOptions,\n SentinelApiServiceInvalidateQueriesAction,\n SentinelApiServiceCacheUpdatedEvent,\n SentinelApiServiceGranularCacheUpdatedEvent,\n SentinelAuthorization,\n SentinelMeta,\n SentinelNetwork,\n SentinelNetworkRegistry,\n SentinelRelaySubmitRequest,\n SentinelRelaySubmitResponse,\n SentinelSignedAuthorization,\n SentinelSimulationCallTrace,\n SentinelSimulationLog,\n SentinelSimulationRequest,\n SentinelSimulationResponse,\n SentinelSimulationResponseTransaction,\n SentinelSimulationStateDiff,\n SentinelSimulationTokenFee,\n SentinelSimulationTransaction,\n SentinelSmartTransaction,\n SentinelSmartTransactionRequest,\n SentinelSmartTransactionResponse,\n SentinelStateOverrides,\n} from './types.js';\nexport {\n SentinelFeature,\n SentinelKind,\n SentinelSmartTransactionStatus,\n} from './types.js';\nexport type {\n SentinelApiServiceGetNetworksAction,\n SentinelApiServiceSimulateTransactionsAction,\n SentinelApiServiceSubmitRelayTransactionAction,\n SentinelApiServiceGetSmartTransactionAction,\n} from './sentinel-api-service-method-action-types.js';\nexport {\n SentinelApiResponseValidationError,\n SentinelChainNotSupportedError,\n SentinelJsonRpcError,\n} from './errors.js';\n"]}
@@ -3,19 +3,6 @@
3
3
  * Do not edit manually.
4
4
  */
5
5
  import type { SentinelApiService } from './sentinel-api-service.js';
6
- /**
7
- * Fetches the configuration of a single network from the `/network`
8
- * endpoint of that network's subdomain. The subdomain is resolved from the
9
- * supported-network registry. The result is cached, as the configuration is
10
- * stable.
11
- *
12
- * @param chainId - The chain ID of the network.
13
- * @returns The network configuration.
14
- */
15
- export type SentinelApiServiceGetNetworkAction = {
16
- type: `SentinelApiService:getNetwork`;
17
- handler: SentinelApiService['getNetwork'];
18
- };
19
6
  /**
20
7
  * Fetches the Sentinel supported-network registry. The result is cached, as
21
8
  * the registry is stable and identical across network subdomains.
@@ -71,5 +58,5 @@ export type SentinelApiServiceGetSmartTransactionAction = {
71
58
  /**
72
59
  * Union of all SentinelApiService action types.
73
60
  */
74
- export type SentinelApiServiceMethodActions = SentinelApiServiceGetNetworkAction | SentinelApiServiceGetNetworksAction | SentinelApiServiceSimulateTransactionsAction | SentinelApiServiceSubmitRelayTransactionAction | SentinelApiServiceGetSmartTransactionAction;
61
+ export type SentinelApiServiceMethodActions = SentinelApiServiceGetNetworksAction | SentinelApiServiceSimulateTransactionsAction | SentinelApiServiceSubmitRelayTransactionAction | SentinelApiServiceGetSmartTransactionAction;
75
62
  //# sourceMappingURL=sentinel-api-service-method-action-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sentinel-api-service-method-action-types.d.ts","sourceRoot":"","sources":["../src/sentinel-api-service-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;;;;;;;GAQG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,kBAAkB,CAAC,wBAAwB,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE,wCAAwC,CAAC;IAC/C,OAAO,EAAE,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;CACpD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,+BAA+B,GACvC,kCAAkC,GAClC,mCAAmC,GACnC,4CAA4C,GAC5C,8CAA8C,GAC9C,2CAA2C,CAAC"}
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;;;;;GAKG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,kBAAkB,CAAC,wBAAwB,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE,wCAAwC,CAAC;IAC/C,OAAO,EAAE,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;CACpD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,+BAA+B,GACvC,mCAAmC,GACnC,4CAA4C,GAC5C,8CAA8C,GAC9C,2CAA2C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sentinel-api-service-method-action-types.js","sourceRoot":"","sources":["../src/sentinel-api-service-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SentinelApiService } from './sentinel-api-service.js';\n\n/**\n * Fetches the configuration of a single network from the `/network`\n * endpoint of that network's subdomain. The subdomain is resolved from the\n * supported-network registry. The result is cached, as the configuration is\n * stable.\n *\n * @param chainId - The chain ID of the network.\n * @returns The network configuration.\n */\nexport type SentinelApiServiceGetNetworkAction = {\n type: `SentinelApiService:getNetwork`;\n handler: SentinelApiService['getNetwork'];\n};\n\n/**\n * Fetches the Sentinel supported-network registry. The result is cached, as\n * the registry is stable and identical across network subdomains.\n *\n * @returns The network registry, keyed by decimal chain ID.\n */\nexport type SentinelApiServiceGetNetworksAction = {\n type: `SentinelApiService:getNetworks`;\n handler: SentinelApiService['getNetworks'];\n};\n\n/**\n * Simulates transactions against the Sentinel API via\n * `infura_simulateTransactions`. Not cached, since each request body is\n * unique and stale simulations must not be reused.\n *\n * @param chainId - The chain ID to simulate on.\n * @param request - The simulation request.\n * @param options - Additional options.\n * @param options.getUrl - Optional callback that receives the default\n * Sentinel URL resolved for the chain and returns the URL to use instead.\n * Lets consumers rewrite the request URL (for example to route through the\n * MetaMask Shield proxy) without the service knowing about those concerns.\n * @returns The simulation response.\n */\nexport type SentinelApiServiceSimulateTransactionsAction = {\n type: `SentinelApiService:simulateTransactions`;\n handler: SentinelApiService['simulateTransactions'];\n};\n\n/**\n * Submits a signed relay (gas station) transaction to the Sentinel API via\n * `eth_sendRelayTransaction`. Not cached.\n *\n * @param request - The relay submit request.\n * @returns The relay submit response containing the tracking UUID.\n */\nexport type SentinelApiServiceSubmitRelayTransactionAction = {\n type: `SentinelApiService:submitRelayTransaction`;\n handler: SentinelApiService['submitRelayTransaction'];\n};\n\n/**\n * Looks up the state of a submitted smart transaction by UUID against the\n * `/smart-transactions/{uuid}` endpoint. Performs a single request; callers\n * own any polling loop. Not cached.\n *\n * @param request - The smart-transaction lookup request.\n * @returns The response envelope containing the smart transaction(s)\n * associated with the requested UUID.\n */\nexport type SentinelApiServiceGetSmartTransactionAction = {\n type: `SentinelApiService:getSmartTransaction`;\n handler: SentinelApiService['getSmartTransaction'];\n};\n\n/**\n * Union of all SentinelApiService action types.\n */\nexport type SentinelApiServiceMethodActions =\n | SentinelApiServiceGetNetworkAction\n | SentinelApiServiceGetNetworksAction\n | SentinelApiServiceSimulateTransactionsAction\n | SentinelApiServiceSubmitRelayTransactionAction\n | SentinelApiServiceGetSmartTransactionAction;\n"]}
1
+ {"version":3,"file":"sentinel-api-service-method-action-types.js","sourceRoot":"","sources":["../src/sentinel-api-service-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { SentinelApiService } from './sentinel-api-service.js';\n\n/**\n * Fetches the Sentinel supported-network registry. The result is cached, as\n * the registry is stable and identical across network subdomains.\n *\n * @returns The network registry, keyed by decimal chain ID.\n */\nexport type SentinelApiServiceGetNetworksAction = {\n type: `SentinelApiService:getNetworks`;\n handler: SentinelApiService['getNetworks'];\n};\n\n/**\n * Simulates transactions against the Sentinel API via\n * `infura_simulateTransactions`. Not cached, since each request body is\n * unique and stale simulations must not be reused.\n *\n * @param chainId - The chain ID to simulate on.\n * @param request - The simulation request.\n * @param options - Additional options.\n * @param options.getUrl - Optional callback that receives the default\n * Sentinel URL resolved for the chain and returns the URL to use instead.\n * Lets consumers rewrite the request URL (for example to route through the\n * MetaMask Shield proxy) without the service knowing about those concerns.\n * @returns The simulation response.\n */\nexport type SentinelApiServiceSimulateTransactionsAction = {\n type: `SentinelApiService:simulateTransactions`;\n handler: SentinelApiService['simulateTransactions'];\n};\n\n/**\n * Submits a signed relay (gas station) transaction to the Sentinel API via\n * `eth_sendRelayTransaction`. Not cached.\n *\n * @param request - The relay submit request.\n * @returns The relay submit response containing the tracking UUID.\n */\nexport type SentinelApiServiceSubmitRelayTransactionAction = {\n type: `SentinelApiService:submitRelayTransaction`;\n handler: SentinelApiService['submitRelayTransaction'];\n};\n\n/**\n * Looks up the state of a submitted smart transaction by UUID against the\n * `/smart-transactions/{uuid}` endpoint. Performs a single request; callers\n * own any polling loop. Not cached.\n *\n * @param request - The smart-transaction lookup request.\n * @returns The response envelope containing the smart transaction(s)\n * associated with the requested UUID.\n */\nexport type SentinelApiServiceGetSmartTransactionAction = {\n type: `SentinelApiService:getSmartTransaction`;\n handler: SentinelApiService['getSmartTransaction'];\n};\n\n/**\n * Union of all SentinelApiService action types.\n */\nexport type SentinelApiServiceMethodActions =\n | SentinelApiServiceGetNetworksAction\n | SentinelApiServiceSimulateTransactionsAction\n | SentinelApiServiceSubmitRelayTransactionAction\n | SentinelApiServiceGetSmartTransactionAction;\n"]}
@@ -1,14 +1,12 @@
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, SentinelNetwork, SentinelNetworkRegistry, SentinelRelaySubmitRequest, SentinelRelaySubmitResponse, SentinelSimulationRequest, SentinelSimulationResponse, SentinelSmartTransactionRequest, SentinelSmartTransactionResponse } from './types.js';
4
+ import type { SentinelApiServiceMessenger, SentinelApiServiceOptions, SentinelNetworkRegistry, SentinelRelaySubmitRequest, SentinelRelaySubmitResponse, SentinelSimulationRequest, SentinelSimulationResponse, SentinelSmartTransactionRequest, SentinelSmartTransactionResponse } from './types.js';
5
5
  /**
6
6
  * Data service that centralises all interactions with the MetaMask Sentinel
7
7
  * API (`tx-sentinel-<network>.api.cx.metamask.io`).
8
8
  *
9
9
  * It exposes one method per Sentinel endpoint:
10
- * - {@link SentinelApiService.getNetwork} — the configuration of a single
11
- * network (`/network`), cached since it is stable.
12
10
  * - {@link SentinelApiService.getNetworks} — the supported-network registry
13
11
  * (`/networks`), cached since it is stable and identical across subdomains.
14
12
  * - {@link SentinelApiService.simulateTransactions} — transaction simulation
@@ -46,16 +44,6 @@ export declare class SentinelApiService extends BaseDataService<typeof serviceNa
46
44
  * `maxRetries` here to opt in.
47
45
  */
48
46
  constructor({ messenger, fetch: fetchFunction, environment, clientId, clientVersion, queryClientConfig, policyOptions, }: SentinelApiServiceOptions);
49
- /**
50
- * Fetches the configuration of a single network from the `/network`
51
- * endpoint of that network's subdomain. The subdomain is resolved from the
52
- * supported-network registry. The result is cached, as the configuration is
53
- * stable.
54
- *
55
- * @param chainId - The chain ID of the network.
56
- * @returns The network configuration.
57
- */
58
- getNetwork(chainId: Hex): Promise<SentinelNetwork>;
59
47
  /**
60
48
  * Fetches the Sentinel supported-network registry. The result is cached, as
61
49
  * the registry is stable and identical across network subdomains.
@@ -1 +1 @@
1
- {"version":3,"file":"sentinel-api-service.d.ts","sourceRoot":"","sources":["../src/sentinel-api-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,KAAK,EAAE,GAAG,EAAQ,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAYL,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAcxB,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EACzB,eAAe,EACf,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,EAC3B,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,EAC/B,gCAAgC,EACjC,MAAM,YAAY,CAAC;AAYpB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,kBAAmB,SAAQ,eAAe,CACrD,OAAO,WAAW,EAClB,2BAA2B,CAC5B;;IASC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YAAY,EACV,SAAS,EACT,KAAK,EAAE,aAAgC,EACvC,WAAiC,EACjC,QAAQ,EACR,aAAa,EACb,iBAAsB,EACtB,aAAkB,GACnB,EAAE,yBAAyB,EA+B3B;IAED;;;;;;;;OAQG;IACG,UAAU,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC,CA0CvD;IAED;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAoCpD;IAED;;;;;;;;;;;;;OAaG;IACG,oBAAoB,CACxB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,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BAAyB,EAClC,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;KAAO,GAC1E,OAAO,CAAC,0BAA0B,CAAC,CA4BrC;IAED;;;;;;OAMG;IACG,sBAAsB,CAC1B,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,2BAA2B,CAAC,CA2BtC;IAED;;;;;;;;OAQG;IACG,mBAAmB,CACvB,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,gCAAgC,CAAC,CAsC3C;CA2IF"}
@@ -1,13 +1,12 @@
1
1
  import { BaseDataService } from '@metamask/base-data-service';
2
2
  import { handleWhen, HttpError } from '@metamask/controller-utils';
3
3
  import { validate } from '@metamask/superstruct';
4
- import { BASE_URL_TEMPLATE, DEFAULT_ENVIRONMENT, ENDPOINT_NETWORK, ENDPOINT_NETWORKS, ENDPOINT_SMART_TRANSACTIONS, ENVIRONMENT_DOMAIN, NETWORK_STALE_TIME_MS, NETWORKS_STALE_TIME_MS, NETWORKS_SUBDOMAIN, RPC_METHOD_SEND_RELAY, RPC_METHOD_SIMULATE, serviceName, } from './constants.js';
4
+ import { BASE_URL_TEMPLATE, DEFAULT_ENVIRONMENT, ENDPOINT_NETWORKS, ENDPOINT_SMART_TRANSACTIONS, ENVIRONMENT_DOMAIN, NETWORKS_STALE_TIME_MS, NETWORKS_SUBDOMAIN, RPC_METHOD_SEND_RELAY, RPC_METHOD_SIMULATE, serviceName, } from './constants.js';
5
5
  import { SentinelApiResponseValidationError, SentinelChainNotSupportedError, SentinelJsonRpcError, } from './errors.js';
6
6
  import { projectLogger, createModuleLogger } from './logger.js';
7
- import { SentinelSmartTransactionResponseStruct, SentinelNetworkRegistryStruct, SentinelNetworkStruct, SentinelRelaySubmitResponseStruct, SentinelSimulationResponseStruct, } from './structs.js';
7
+ import { SentinelSmartTransactionResponseStruct, SentinelNetworkRegistryStruct, SentinelRelaySubmitResponseStruct, SentinelSimulationResponseStruct, } from './structs.js';
8
8
  const log = createModuleLogger(projectLogger, serviceName);
9
9
  const MESSENGER_EXPOSED_METHODS = [
10
- 'getNetwork',
11
10
  'getNetworks',
12
11
  'simulateTransactions',
13
12
  'submitRelayTransaction',
@@ -18,8 +17,6 @@ const MESSENGER_EXPOSED_METHODS = [
18
17
  * API (`tx-sentinel-<network>.api.cx.metamask.io`).
19
18
  *
20
19
  * It exposes one method per Sentinel endpoint:
21
- * - {@link SentinelApiService.getNetwork} — the configuration of a single
22
- * network (`/network`), cached since it is stable.
23
20
  * - {@link SentinelApiService.getNetworks} — the supported-network registry
24
21
  * (`/networks`), cached since it is stable and identical across subdomains.
25
22
  * - {@link SentinelApiService.simulateTransactions} — transaction simulation
@@ -82,42 +79,6 @@ export class SentinelApiService extends BaseDataService {
82
79
  this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
83
80
  log('Initialized');
84
81
  }
85
- /**
86
- * Fetches the configuration of a single network from the `/network`
87
- * endpoint of that network's subdomain. The subdomain is resolved from the
88
- * supported-network registry. The result is cached, as the configuration is
89
- * stable.
90
- *
91
- * @param chainId - The chain ID of the network.
92
- * @returns The network configuration.
93
- */
94
- async getNetwork(chainId) {
95
- const registryEntry = await this.#getRegistryEntry(chainId);
96
- if (!registryEntry) {
97
- throw new SentinelChainNotSupportedError(chainId);
98
- }
99
- const url = `${this.#buildUrl(registryEntry.network)}${ENDPOINT_NETWORK}`;
100
- const result = await this.fetchQuery({
101
- queryKey: [`${this.name}:getNetwork`, chainId],
102
- staleTime: NETWORK_STALE_TIME_MS,
103
- queryFn: async () => {
104
- const headers = await this.#getHeaders();
105
- log('getNetwork', 'Request', url);
106
- const response = await this.#fetch(url, { headers });
107
- if (!response.ok) {
108
- throw new HttpError(response.status, `Sentinel API: Network request failed with status '${response.status}'`);
109
- }
110
- const json = (await response.json());
111
- const [error] = validate(json, SentinelNetworkStruct);
112
- if (error) {
113
- throw new SentinelApiResponseValidationError(`Sentinel API: Malformed response from network endpoint: ${error.message}`);
114
- }
115
- log('getNetwork', 'Response', json);
116
- return json;
117
- },
118
- });
119
- return result;
120
- }
121
82
  /**
122
83
  * Fetches the Sentinel supported-network registry. The result is cached, as
123
84
  * the registry is stable and identical across network subdomains.
@@ -314,7 +275,7 @@ export class SentinelApiService extends BaseDataService {
314
275
  * @returns The resolved base URL.
315
276
  */
316
277
  async #resolveUrl(chainId, capability) {
317
- const network = await this.#getRegistryEntry(chainId);
278
+ const network = await this.#getNetwork(chainId);
318
279
  if (!network?.[capability]) {
319
280
  throw new SentinelChainNotSupportedError(chainId, capability);
320
281
  }
@@ -326,7 +287,7 @@ export class SentinelApiService extends BaseDataService {
326
287
  * @param chainId - The chain ID to look up.
327
288
  * @returns The network entry, or undefined if not present.
328
289
  */
329
- async #getRegistryEntry(chainId) {
290
+ async #getNetwork(chainId) {
330
291
  const registry = await this.getNetworks();
331
292
  const chainIdDecimal = BigInt(chainId).toString(10);
332
293
  return registry[chainIdDecimal];
@@ -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,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,aAAa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,yCAAyC,CAC1C,CAAC;YACF,IAAI,KAAK,EAAE,CAAC;gBACV,OAAO,CAAC,aAAa,GAAG,UAAU,KAAK,EAAE,CAAC;YAC5C,CAAC;QACH,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,iDAAiD;YACjD,GAAG,CACD,YAAY,EACZ,oDAAoD,EACpD,KAAK,CACN,CAAC;QACJ,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,WAAW,CACf,OAAY,EACZ,UAAiD;QAEjD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAEtD,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,8BAA8B,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAChE,CAAC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,iBAAiB,CAAC,OAAY;QAClC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1C,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACpD,OAAO,QAAQ,CAAC,cAAc,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;OAMG;IACH,SAAS,CAAC,SAAiB;QACzB,OAAO,iBAAiB,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,OAAO,CACxD,KAAK,EACL,IAAI,CAAC,kBAAkB,CACxB,CAAC;IACJ,CAAC;CACF","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 SentinelNetworkRegistryStruct,\n SentinelNetworkStruct,\n SentinelRelaySubmitResponseStruct,\n SentinelSimulationResponseStruct,\n} from './structs.js';\nimport type {\n SentinelApiServiceMessenger,\n SentinelApiServiceOptions,\n SentinelNetwork,\n SentinelNetworkRegistry,\n SentinelRelaySubmitRequest,\n SentinelRelaySubmitResponse,\n SentinelSimulationRequest,\n SentinelSimulationResponse,\n SentinelSmartTransactionRequest,\n SentinelSmartTransactionResponse,\n} from './types.js';\n\nconst log = createModuleLogger(projectLogger, serviceName);\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'getNetwork',\n 'getNetworks',\n 'simulateTransactions',\n 'submitRelayTransaction',\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 *\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 * 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"]}
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,iBAAiB,EACjB,2BAA2B,EAC3B,kBAAkB,EAClB,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,MAA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AO,KAAc,EAAE,CAAC;YACxB,iDAAiD;YACjD,GAAG,CACD,YAAY,EACZ,oDAAoD,EACpD,KAAK,CACN,CAAC;QACJ,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,WAAW,CACf,OAAY,EACZ,UAAiD;QAEjD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAEhD,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,8BAA8B,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAChE,CAAC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CAAC,OAAY;QAC5B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1C,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACpD,OAAO,QAAQ,CAAC,cAAc,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;OAMG;IACH,SAAS,CAAC,SAAiB;QACzB,OAAO,iBAAiB,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,OAAO,CACxD,KAAK,EACL,IAAI,CAAC,kBAAkB,CACxB,CAAC;IACJ,CAAC;CACF","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_NETWORKS,\n ENDPOINT_SMART_TRANSACTIONS,\n ENVIRONMENT_DOMAIN,\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 SentinelNetworkRegistryStruct,\n SentinelRelaySubmitResponseStruct,\n SentinelSimulationResponseStruct,\n} from './structs.js';\nimport type {\n SentinelApiServiceMessenger,\n SentinelApiServiceOptions,\n SentinelNetwork,\n SentinelNetworkRegistry,\n SentinelRelaySubmitRequest,\n SentinelRelaySubmitResponse,\n SentinelSimulationRequest,\n SentinelSimulationResponse,\n SentinelSmartTransactionRequest,\n SentinelSmartTransactionResponse,\n} from './types.js';\n\nconst log = createModuleLogger(projectLogger, serviceName);\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'getNetworks',\n 'simulateTransactions',\n 'submitRelayTransaction',\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.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 *\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 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 * 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.#getNetwork(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 #getNetwork(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"]}
package/dist/structs.d.ts CHANGED
@@ -1,41 +1,14 @@
1
- /**
2
- * Validates a single network entry from the `/networks` registry, or the
3
- * single network configuration from the `/network` endpoint. Uses `type`
4
- * (loose) validation so that additional fields returned by the API do not
5
- * cause rejection; only the fields we depend on are asserted.
6
- */
7
- export declare const SentinelNetworkStruct: import("@metamask/superstruct").Struct<{
8
- chainID?: number | undefined;
9
- confirmations?: boolean | undefined;
10
- cubistSigners?: `0x${string}`[] | undefined;
11
- network: string;
12
- relayTransactions?: boolean | undefined;
13
- sendBundle?: boolean | undefined;
14
- simulationIncludeFees?: boolean | undefined;
15
- smartTransactions?: boolean | undefined;
16
- }, {
17
- chainID: import("@metamask/superstruct").Struct<number | undefined, null>;
18
- confirmations: import("@metamask/superstruct").Struct<boolean | undefined, null>;
19
- cubistSigners: import("@metamask/superstruct").Struct<`0x${string}`[] | undefined, import("@metamask/superstruct").Struct<`0x${string}`, null>>;
20
- network: import("@metamask/superstruct").Struct<string, null>;
21
- relayTransactions: import("@metamask/superstruct").Struct<boolean | undefined, null>;
22
- sendBundle: import("@metamask/superstruct").Struct<boolean | undefined, null>;
23
- simulationIncludeFees: import("@metamask/superstruct").Struct<boolean | undefined, null>;
24
- smartTransactions: import("@metamask/superstruct").Struct<boolean | undefined, null>;
25
- }>;
26
1
  /**
27
2
  * Validates the `/networks` registry response (a map keyed by decimal chain
28
3
  * ID).
29
4
  */
30
5
  export declare const SentinelNetworkRegistryStruct: import("@metamask/superstruct").Struct<Record<string, {
31
- chainID?: number | undefined;
32
- confirmations?: boolean | undefined;
33
- cubistSigners?: `0x${string}`[] | undefined;
34
6
  network: string;
7
+ confirmations?: boolean | undefined;
8
+ chainID?: number | undefined;
35
9
  relayTransactions?: boolean | undefined;
36
- sendBundle?: boolean | undefined;
37
- simulationIncludeFees?: boolean | undefined;
38
10
  smartTransactions?: boolean | undefined;
11
+ sendBundle?: boolean | undefined;
39
12
  }>, null>;
40
13
  /**
41
14
  * Validates the top-level simulation response. Only the `transactions` array
@@ -1 +1 @@
1
- {"version":3,"file":"structs.d.ts","sourceRoot":"","sources":["../src/structs.ts"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;EAShC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;SAGzC,CAAC;AAUF;;;GAGG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;EAE3C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iCAAiC;;;;EAE5C,CAAC;AAWH;;;GAGG;AACH,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;;;;EAEjD,CAAC"}
1
+ {"version":3,"file":"structs.d.ts","sourceRoot":"","sources":["../src/structs.ts"],"names":[],"mappings":"AAyBA;;;GAGG;AACH,eAAO,MAAM,6BAA6B;;;;;;;SAGzC,CAAC;AAUF;;;GAGG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;EAE3C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iCAAiC;;;;EAE5C,CAAC;AAWH;;;GAGG;AACH,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;;;;EAEjD,CAAC"}
package/dist/structs.js CHANGED
@@ -1,20 +1,16 @@
1
1
  import { array, boolean, nullable, number, optional, record, string, type, } from '@metamask/superstruct';
2
- import { StrictHexStruct } from '@metamask/utils';
3
2
  /**
4
- * Validates a single network entry from the `/networks` registry, or the
5
- * single network configuration from the `/network` endpoint. Uses `type`
3
+ * Validates a single network entry from the `/networks` registry. Uses `type`
6
4
  * (loose) validation so that additional fields returned by the API do not
7
5
  * cause rejection; only the fields we depend on are asserted.
8
6
  */
9
- export const SentinelNetworkStruct = type({
10
- chainID: optional(number()),
11
- confirmations: optional(boolean()),
12
- cubistSigners: optional(array(StrictHexStruct)),
7
+ const SentinelNetworkStruct = type({
13
8
  network: string(),
9
+ confirmations: optional(boolean()),
10
+ chainID: optional(number()),
14
11
  relayTransactions: optional(boolean()),
15
- sendBundle: optional(boolean()),
16
- simulationIncludeFees: optional(boolean()),
17
12
  smartTransactions: optional(boolean()),
13
+ sendBundle: optional(boolean()),
18
14
  });
19
15
  /**
20
16
  * Validates the `/networks` registry response (a map keyed by decimal chain
@@ -1 +1 @@
1
- {"version":3,"file":"structs.js","sourceRoot":"","sources":["../src/structs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,MAAM,EACN,IAAI,GACL,MAAM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;;;GAGG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,IAAI,CAAC;IACzD,YAAY,EAAE,KAAK,CAAC,8BAA8B,CAAC;CACpD,CAAC,CAAC","sourcesContent":["import {\n array,\n boolean,\n nullable,\n number,\n optional,\n record,\n string,\n type,\n} from '@metamask/superstruct';\nimport { StrictHexStruct } from '@metamask/utils';\n\n/**\n * Validates a single network entry from the `/networks` registry, or the\n * single network configuration from the `/network` endpoint. Uses `type`\n * (loose) validation so that additional fields returned by the API do not\n * cause rejection; only the fields we depend on are asserted.\n */\nexport const SentinelNetworkStruct = type({\n chainID: optional(number()),\n confirmations: optional(boolean()),\n cubistSigners: optional(array(StrictHexStruct)),\n network: string(),\n relayTransactions: optional(boolean()),\n sendBundle: optional(boolean()),\n simulationIncludeFees: optional(boolean()),\n smartTransactions: optional(boolean()),\n});\n\n/**\n * Validates the `/networks` registry response (a map keyed by decimal chain\n * ID).\n */\nexport const SentinelNetworkRegistryStruct = record(\n string(),\n SentinelNetworkStruct,\n);\n\n/**\n * Validates a simulated-transaction result. Loose to tolerate the many\n * optional fields the API may return.\n */\nconst SentinelSimulationResponseTransactionStruct = type({\n error: optional(string()),\n});\n\n/**\n * Validates the top-level simulation response. Only the `transactions` array\n * is required by consumers.\n */\nexport const SentinelSimulationResponseStruct = type({\n transactions: array(SentinelSimulationResponseTransactionStruct),\n});\n\n/**\n * Validates the response from submitting a relay transaction.\n */\nexport const SentinelRelaySubmitResponseStruct = type({\n uuid: string(),\n});\n\n/**\n * Validates a single entry in the smart-transactions endpoint response.\n */\nconst SentinelSmartTransactionStruct = type({\n hash: optional(string()),\n status: string(),\n errorReason: optional(nullable(string())),\n});\n\n/**\n * Validates the smart-transactions endpoint response body (a list of\n * transactions).\n */\nexport const SentinelSmartTransactionResponseStruct = type({\n transactions: array(SentinelSmartTransactionStruct),\n});\n"]}
1
+ {"version":3,"file":"structs.js","sourceRoot":"","sources":["../src/structs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL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AC,8BAA8B,CAAC;CACpD,CAAC,CAAC","sourcesContent":["import {\n array,\n boolean,\n nullable,\n number,\n optional,\n record,\n string,\n type,\n} from '@metamask/superstruct';\n\n/**\n * Validates a single network entry from the `/networks` registry. Uses `type`\n * (loose) validation so that additional fields returned by the API do not\n * cause rejection; only the fields we depend on are asserted.\n */\nconst SentinelNetworkStruct = type({\n network: string(),\n confirmations: optional(boolean()),\n chainID: optional(number()),\n relayTransactions: optional(boolean()),\n smartTransactions: optional(boolean()),\n sendBundle: optional(boolean()),\n});\n\n/**\n * Validates the `/networks` registry response (a map keyed by decimal chain\n * ID).\n */\nexport const SentinelNetworkRegistryStruct = record(\n string(),\n SentinelNetworkStruct,\n);\n\n/**\n * Validates a simulated-transaction result. Loose to tolerate the many\n * optional fields the API may return.\n */\nconst SentinelSimulationResponseTransactionStruct = type({\n error: optional(string()),\n});\n\n/**\n * Validates the top-level simulation response. Only the `transactions` array\n * is required by consumers.\n */\nexport const SentinelSimulationResponseStruct = type({\n transactions: array(SentinelSimulationResponseTransactionStruct),\n});\n\n/**\n * Validates the response from submitting a relay transaction.\n */\nexport const SentinelRelaySubmitResponseStruct = type({\n uuid: string(),\n});\n\n/**\n * Validates a single entry in the smart-transactions endpoint response.\n */\nconst SentinelSmartTransactionStruct = type({\n hash: optional(string()),\n status: string(),\n errorReason: optional(nullable(string())),\n});\n\n/**\n * Validates the smart-transactions endpoint response body (a list of\n * transactions).\n */\nexport const SentinelSmartTransactionResponseStruct = type({\n transactions: array(SentinelSmartTransactionStruct),\n});\n"]}
package/dist/types.d.ts CHANGED
@@ -225,26 +225,21 @@ export type SentinelSmartTransactionRequest = {
225
225
  uuid: string;
226
226
  };
227
227
  /**
228
- * A single network entry from the Sentinel `/networks` registry, or the
229
- * configuration of a single network from the `/network` endpoint.
228
+ * A single network entry from the Sentinel `/networks` registry.
230
229
  */
231
230
  export type SentinelNetwork = {
232
- /** Raw field name from the Sentinel API response; note uppercase 'D'. */
233
- chainID?: number;
234
231
  /** Whether simulation (confirmations) is supported for this chain. */
235
232
  confirmations?: boolean;
236
- /** Addresses of the relay signers that submit relay transactions. */
237
- cubistSigners?: Hex[];
233
+ /** Raw field name from the Sentinel API response; note uppercase 'D'. */
234
+ chainID?: number;
238
235
  /** The subdomain used to build the Sentinel URL for this chain. */
239
236
  network: string;
240
237
  /** Whether the gas station relay is supported for this chain. */
241
238
  relayTransactions?: boolean;
242
- /** Whether the bundle path is supported for this chain. */
243
- sendBundle?: boolean;
244
- /** Whether simulations on this chain include gas fees for native tokens. */
245
- simulationIncludeFees?: boolean;
246
239
  /** Whether smart transactions are supported for this chain. */
247
240
  smartTransactions?: boolean;
241
+ /** Whether the bundle path is supported for this chain. */
242
+ sendBundle?: boolean;
248
243
  };
249
244
  /**
250
245
  * The Sentinel `/networks` registry response, keyed by decimal chain ID.
@@ -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,GAC/B,yCAAyC,CAAC;AAE9C;;GAEG;AACH,MAAM,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C;CACd,CAAC;AAEF;;;GAGG;AACH,oBAAY,8BAA8B;IACxC,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,MAAM,WAAW;CAClB;AAED;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC7C,YAAY,EAAE,wBAAwB,EAAE,CAAC;CAC1C,CAAC"}
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;;;GAGG;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;AAgXD;;;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","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 */\nexport enum SentinelKind {\n Bundle = 'bundle',\n Default = 'default',\n GaslessEIP7702 = 'gaslessEIP7702',\n GaslessSendBundle = 'gaslessSendBundle',\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;\n kind?: SentinelKind;\n origin?: string;\n txType?: string;\n wallet?: 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 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 /** 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 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\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"]}
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;;;GAGG;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;AAyWD;;;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","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 */\nexport enum SentinelKind {\n Bundle = 'bundle',\n Default = 'default',\n GaslessEIP7702 = 'gaslessEIP7702',\n GaslessSendBundle = 'gaslessSendBundle',\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;\n kind?: SentinelKind;\n origin?: string;\n txType?: string;\n wallet?: 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 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 /** 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 single network entry from the Sentinel `/networks` registry.\n */\nexport type SentinelNetwork = {\n /** Whether simulation (confirmations) is supported for this chain. */\n confirmations?: boolean;\n\n /** Raw field name from the Sentinel API response; note uppercase 'D'. */\n chainID?: number;\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 smart transactions are supported for this chain. */\n smartTransactions?: boolean;\n\n /** Whether the bundle path is supported for this chain. */\n sendBundle?: 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\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/sentinel-api-service",
3
- "version": "2.0.0-preview-1a7a6d6d6",
3
+ "version": "2.0.0-preview-cbae429b5",
4
4
  "description": "Data service for the MetaMask Sentinel API",
5
5
  "keywords": [
6
6
  "Ethereum",
@@ -66,7 +66,7 @@
66
66
  "nock": "^13.5.6",
67
67
  "rimraf": "^6.1.3",
68
68
  "ts-jest": "^29.4.14",
69
- "typedoc": "^0.28.20",
69
+ "typedoc": "^0.25.13",
70
70
  "typedoc-plugin-missing-exports": "^2.0.0",
71
71
  "typescript": "npm:@typescript/typescript6@^6.0.2"
72
72
  },