@metamask/smart-transactions-controller 21.0.0 → 22.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +24 -1
  2. package/README.md +47 -0
  3. package/dist/SmartTransactionsController.cjs +32 -8
  4. package/dist/SmartTransactionsController.cjs.map +1 -1
  5. package/dist/SmartTransactionsController.d.cts +24 -6
  6. package/dist/SmartTransactionsController.d.cts.map +1 -1
  7. package/dist/SmartTransactionsController.d.mts +24 -6
  8. package/dist/SmartTransactionsController.d.mts.map +1 -1
  9. package/dist/SmartTransactionsController.mjs +33 -9
  10. package/dist/SmartTransactionsController.mjs.map +1 -1
  11. package/dist/constants.cjs +21 -1
  12. package/dist/constants.cjs.map +1 -1
  13. package/dist/constants.d.cts +20 -0
  14. package/dist/constants.d.cts.map +1 -1
  15. package/dist/constants.d.mts +20 -0
  16. package/dist/constants.d.mts.map +1 -1
  17. package/dist/constants.mjs +20 -0
  18. package/dist/constants.mjs.map +1 -1
  19. package/dist/featureFlags/feature-flags.cjs +119 -0
  20. package/dist/featureFlags/feature-flags.cjs.map +1 -0
  21. package/dist/featureFlags/feature-flags.d.cts +76 -0
  22. package/dist/featureFlags/feature-flags.d.cts.map +1 -0
  23. package/dist/featureFlags/feature-flags.d.mts +76 -0
  24. package/dist/featureFlags/feature-flags.d.mts.map +1 -0
  25. package/dist/featureFlags/feature-flags.mjs +112 -0
  26. package/dist/featureFlags/feature-flags.mjs.map +1 -0
  27. package/dist/featureFlags/index.cjs +14 -0
  28. package/dist/featureFlags/index.cjs.map +1 -0
  29. package/dist/featureFlags/index.d.cts +3 -0
  30. package/dist/featureFlags/index.d.cts.map +1 -0
  31. package/dist/featureFlags/index.d.mts +3 -0
  32. package/dist/featureFlags/index.d.mts.map +1 -0
  33. package/dist/featureFlags/index.mjs +3 -0
  34. package/dist/featureFlags/index.mjs.map +1 -0
  35. package/dist/featureFlags/validators.cjs +126 -0
  36. package/dist/featureFlags/validators.cjs.map +1 -0
  37. package/dist/featureFlags/validators.d.cts +141 -0
  38. package/dist/featureFlags/validators.d.cts.map +1 -0
  39. package/dist/featureFlags/validators.d.mts +141 -0
  40. package/dist/featureFlags/validators.d.mts.map +1 -0
  41. package/dist/featureFlags/validators.mjs +121 -0
  42. package/dist/featureFlags/validators.mjs.map +1 -0
  43. package/dist/index.cjs +5 -1
  44. package/dist/index.cjs.map +1 -1
  45. package/dist/index.d.cts +2 -1
  46. package/dist/index.d.cts.map +1 -1
  47. package/dist/index.d.mts +2 -1
  48. package/dist/index.d.mts.map +1 -1
  49. package/dist/index.mjs +2 -0
  50. package/dist/index.mjs.map +1 -1
  51. package/dist/selectors.cjs +66 -0
  52. package/dist/selectors.cjs.map +1 -0
  53. package/dist/selectors.d.cts +177 -0
  54. package/dist/selectors.d.cts.map +1 -0
  55. package/dist/selectors.d.mts +177 -0
  56. package/dist/selectors.d.mts.map +1 -0
  57. package/dist/selectors.mjs +63 -0
  58. package/dist/selectors.mjs.map +1 -0
  59. package/dist/types.cjs.map +1 -1
  60. package/dist/types.d.cts +24 -1
  61. package/dist/types.d.cts.map +1 -1
  62. package/dist/types.d.mts +24 -1
  63. package/dist/types.d.mts.map +1 -1
  64. package/dist/types.mjs.map +1 -1
  65. package/dist/utils.cjs +5 -7
  66. package/dist/utils.cjs.map +1 -1
  67. package/dist/utils.d.cts +4 -4
  68. package/dist/utils.d.cts.map +1 -1
  69. package/dist/utils.d.mts +4 -4
  70. package/dist/utils.d.mts.map +1 -1
  71. package/dist/utils.mjs +5 -7
  72. package/dist/utils.mjs.map +1 -1
  73. package/package.json +9 -5
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateSmartTransactionsNetworkConfig = exports.validateSmartTransactionsFeatureFlags = exports.SmartTransactionsFeatureFlagsConfigSchema = exports.SmartTransactionsNetworkConfigSchema = void 0;
4
+ const superstruct_1 = require("@metamask/superstruct");
5
+ const utils_1 = require("@metamask/utils");
6
+ /**
7
+ * Validates that a key is a valid chain ID (hex or CAIP-2 format).
8
+ * Supports both EVM hex chain IDs and chain-agnostic CAIP-2 identifiers.
9
+ *
10
+ * @param key - The key to validate
11
+ * @returns True if the key is a valid chain ID format
12
+ */
13
+ function isValidChainIdKey(key) {
14
+ return (0, utils_1.isStrictHexString)(key) || (0, utils_1.isCaipChainId)(key);
15
+ }
16
+ /**
17
+ * Schema for validating per-network smart transactions configuration.
18
+ * All fields are optional to allow partial configuration and merging with defaults.
19
+ */
20
+ exports.SmartTransactionsNetworkConfigSchema = (0, superstruct_1.type)({
21
+ /** Whether smart transactions are active for the extension client */
22
+ extensionActive: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
23
+ /** Whether smart transactions are active for mobile clients (generic) */
24
+ mobileActive: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
25
+ /** Whether smart transactions are active for iOS specifically */
26
+ mobileActiveIOS: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
27
+ /** Whether smart transactions are active for Android specifically */
28
+ mobileActiveAndroid: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
29
+ /** Expected time in seconds for a smart transaction to be mined */
30
+ expectedDeadline: (0, superstruct_1.optional)((0, superstruct_1.number)()),
31
+ /** Maximum time in seconds before a smart transaction is considered failed */
32
+ maxDeadline: (0, superstruct_1.optional)((0, superstruct_1.number)()),
33
+ /** Whether extension should return tx hash immediately without waiting for confirmation */
34
+ extensionReturnTxHashAsap: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
35
+ /** Whether extension should return tx hash immediately for batch transactions */
36
+ extensionReturnTxHashAsapBatch: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
37
+ /** Whether mobile should return tx hash immediately without waiting for confirmation */
38
+ mobileReturnTxHashAsap: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
39
+ /** Whether extension should skip the smart transaction status page */
40
+ extensionSkipSmartTransactionStatusPage: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
41
+ /** Polling interval in milliseconds for batch status updates */
42
+ batchStatusPollingInterval: (0, superstruct_1.optional)((0, superstruct_1.number)()),
43
+ /** Custom sentinel URL for the network */
44
+ sentinelUrl: (0, superstruct_1.optional)((0, superstruct_1.string)()),
45
+ });
46
+ /**
47
+ * Schema for validating the complete smart transactions feature flags configuration.
48
+ * This includes a default configuration and optional chain-specific overrides.
49
+ */
50
+ exports.SmartTransactionsFeatureFlagsConfigSchema = (0, superstruct_1.type)({
51
+ /** Default configuration applied to all chains unless overridden */
52
+ default: (0, superstruct_1.optional)(exports.SmartTransactionsNetworkConfigSchema),
53
+ });
54
+ /**
55
+ * Validates smart transactions feature flags with per-chain validation.
56
+ * - If the input is not an object, returns empty config with error
57
+ * - If `default` is present and invalid, returns empty config with error
58
+ * - For each chain: if invalid, removes it and collects error; if valid, includes it
59
+ *
60
+ * @param data - The data to validate
61
+ * @returns The validated config and any validation errors
62
+ */
63
+ function validateSmartTransactionsFeatureFlags(data) {
64
+ const errors = [];
65
+ // Step 1: Check if it's a valid object
66
+ if (typeof data !== 'object' || data === null || Array.isArray(data)) {
67
+ const typeDescription = data === null ? 'null' : typeof data;
68
+ const arraySuffix = Array.isArray(data) ? ' (array)' : '';
69
+ return {
70
+ config: {},
71
+ errors: [
72
+ new Error(`Expected an object, received ${typeDescription}${arraySuffix}`),
73
+ ],
74
+ };
75
+ }
76
+ const dataRecord = data;
77
+ const validConfig = {};
78
+ // Step 2: Validate 'default' - if present and invalid, reject everything
79
+ if (dataRecord.default !== undefined) {
80
+ const [defaultError, validatedDefault] = (0, superstruct_1.validate)(dataRecord.default, exports.SmartTransactionsNetworkConfigSchema);
81
+ if (defaultError) {
82
+ return {
83
+ config: {},
84
+ errors: [
85
+ new Error(`Invalid 'default' config: ${defaultError.message}`),
86
+ ],
87
+ };
88
+ }
89
+ // validatedDefault is properly typed from superstruct
90
+ validConfig.default = validatedDefault;
91
+ }
92
+ // Step 3: Validate chain-specific configs, keeping valid ones
93
+ for (const [key, value] of Object.entries(dataRecord)) {
94
+ if (key === 'default') {
95
+ continue;
96
+ }
97
+ // Check chain ID format
98
+ if (!isValidChainIdKey(key)) {
99
+ errors.push(new Error(`Invalid chain ID key "${key}". Expected hex string (e.g., "0x1") or CAIP-2 format (e.g., "eip155:1", "solana:...")`));
100
+ continue; // Skip this chain, don't add to result
101
+ }
102
+ // Validate chain config
103
+ if (value !== undefined) {
104
+ const [chainError, validatedChain] = (0, superstruct_1.validate)(value, exports.SmartTransactionsNetworkConfigSchema);
105
+ if (chainError) {
106
+ errors.push(new Error(`Chain "${key}": ${chainError.message}`));
107
+ continue; // Skip this chain, don't add to result
108
+ }
109
+ // validatedChain is properly typed from superstruct
110
+ validConfig[key] = validatedChain;
111
+ }
112
+ }
113
+ return { config: validConfig, errors };
114
+ }
115
+ exports.validateSmartTransactionsFeatureFlags = validateSmartTransactionsFeatureFlags;
116
+ /**
117
+ * Validates that the given data conforms to the SmartTransactionsNetworkConfig schema.
118
+ *
119
+ * @param data - The data to validate
120
+ * @returns True if the data is valid, false otherwise
121
+ */
122
+ function validateSmartTransactionsNetworkConfig(data) {
123
+ return (0, superstruct_1.is)(data, exports.SmartTransactionsNetworkConfigSchema);
124
+ }
125
+ exports.validateSmartTransactionsNetworkConfig = validateSmartTransactionsNetworkConfig;
126
+ //# sourceMappingURL=validators.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.cjs","sourceRoot":"","sources":["../../src/featureFlags/validators.ts"],"names":[],"mappings":";;;AAAA,uDAQ+B;AAE/B,2CAAmE;AAEnE;;;;;;GAMG;AACH,SAAS,iBAAiB,CAAC,GAAW;IACpC,OAAO,IAAA,yBAAiB,EAAC,GAAG,CAAC,IAAI,IAAA,qBAAa,EAAC,GAAG,CAAC,CAAC;AACtD,CAAC;AAED;;;GAGG;AACU,QAAA,oCAAoC,GAAG,IAAA,kBAAI,EAAC;IACvD,qEAAqE;IACrE,eAAe,EAAE,IA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AS,CAAC,uCAAuC;SAClD;QAED,wBAAwB;QACxB,IAAI,KAAK,KAAK,SAAS,EAAE;YACvB,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,GAAG,IAAA,sBAAQ,EAC3C,KAAK,EACL,4CAAoC,CACrC,CAAC;YACF,IAAI,UAAU,EAAE;gBACd,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,UAAU,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;gBAChE,SAAS,CAAC,uCAAuC;aAClD;YACD,oDAAoD;YACpD,WAAW,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC;SACnC;KACF;IAED,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;AACzC,CAAC;AAxED,sFAwEC;AAED;;;;;GAKG;AACH,SAAgB,sCAAsC,CACpD,IAAa;IAEb,OAAO,IAAA,gBAAE,EAAC,IAAI,EAAE,4CAAoC,CAAC,CAAC;AACxD,CAAC;AAJD,wFAIC","sourcesContent":["import {\n boolean,\n number,\n optional,\n string,\n type,\n is,\n validate,\n} from '@metamask/superstruct';\nimport type { Infer } from '@metamask/superstruct';\nimport { isCaipChainId, isStrictHexString } from '@metamask/utils';\n\n/**\n * Validates that a key is a valid chain ID (hex or CAIP-2 format).\n * Supports both EVM hex chain IDs and chain-agnostic CAIP-2 identifiers.\n *\n * @param key - The key to validate\n * @returns True if the key is a valid chain ID format\n */\nfunction isValidChainIdKey(key: string): boolean {\n return isStrictHexString(key) || isCaipChainId(key);\n}\n\n/**\n * Schema for validating per-network smart transactions configuration.\n * All fields are optional to allow partial configuration and merging with defaults.\n */\nexport const SmartTransactionsNetworkConfigSchema = type({\n /** Whether smart transactions are active for the extension client */\n extensionActive: optional(boolean()),\n /** Whether smart transactions are active for mobile clients (generic) */\n mobileActive: optional(boolean()),\n /** Whether smart transactions are active for iOS specifically */\n mobileActiveIOS: optional(boolean()),\n /** Whether smart transactions are active for Android specifically */\n mobileActiveAndroid: optional(boolean()),\n /** Expected time in seconds for a smart transaction to be mined */\n expectedDeadline: optional(number()),\n /** Maximum time in seconds before a smart transaction is considered failed */\n maxDeadline: optional(number()),\n /** Whether extension should return tx hash immediately without waiting for confirmation */\n extensionReturnTxHashAsap: optional(boolean()),\n /** Whether extension should return tx hash immediately for batch transactions */\n extensionReturnTxHashAsapBatch: optional(boolean()),\n /** Whether mobile should return tx hash immediately without waiting for confirmation */\n mobileReturnTxHashAsap: optional(boolean()),\n /** Whether extension should skip the smart transaction status page */\n extensionSkipSmartTransactionStatusPage: optional(boolean()),\n /** Polling interval in milliseconds for batch status updates */\n batchStatusPollingInterval: optional(number()),\n /** Custom sentinel URL for the network */\n sentinelUrl: optional(string()),\n});\n\n/**\n * Schema for validating the complete smart transactions feature flags configuration.\n * This includes a default configuration and optional chain-specific overrides.\n */\nexport const SmartTransactionsFeatureFlagsConfigSchema = type({\n /** Default configuration applied to all chains unless overridden */\n default: optional(SmartTransactionsNetworkConfigSchema),\n});\n\n/**\n * Type inferred from the SmartTransactionsNetworkConfigSchema\n */\nexport type SmartTransactionsNetworkConfigFromSchema = Infer<\n typeof SmartTransactionsNetworkConfigSchema\n>;\n\n/**\n * Type inferred from the SmartTransactionsFeatureFlagsConfigSchema\n */\nexport type SmartTransactionsFeatureFlagsConfigFromSchema = Infer<\n typeof SmartTransactionsFeatureFlagsConfigSchema\n>;\n\n/**\n * Result of processing feature flags with collected validation errors.\n * Uses per-chain validation: invalid chains are removed, valid ones are kept.\n */\nexport type FeatureFlagsProcessResult = {\n /** The validated configuration (may be partial if some chains were invalid) */\n config: SmartTransactionsFeatureFlagsConfigFromSchema &\n Record<string, SmartTransactionsNetworkConfigFromSchema | undefined>;\n /** Validation errors for invalid parts of the configuration */\n errors: Error[];\n};\n\n/**\n * Validates smart transactions feature flags with per-chain validation.\n * - If the input is not an object, returns empty config with error\n * - If `default` is present and invalid, returns empty config with error\n * - For each chain: if invalid, removes it and collects error; if valid, includes it\n *\n * @param data - The data to validate\n * @returns The validated config and any validation errors\n */\nexport function validateSmartTransactionsFeatureFlags(\n data: unknown,\n): FeatureFlagsProcessResult {\n const errors: Error[] = [];\n\n // Step 1: Check if it's a valid object\n if (typeof data !== 'object' || data === null || Array.isArray(data)) {\n const typeDescription = data === null ? 'null' : typeof data;\n const arraySuffix = Array.isArray(data) ? ' (array)' : '';\n return {\n config: {},\n errors: [\n new Error(\n `Expected an object, received ${typeDescription}${arraySuffix}`,\n ),\n ],\n };\n }\n\n const dataRecord = data as Record<string, unknown>;\n const validConfig: FeatureFlagsProcessResult['config'] = {};\n\n // Step 2: Validate 'default' - if present and invalid, reject everything\n if (dataRecord.default !== undefined) {\n const [defaultError, validatedDefault] = validate(\n dataRecord.default,\n SmartTransactionsNetworkConfigSchema,\n );\n if (defaultError) {\n return {\n config: {},\n errors: [\n new Error(`Invalid 'default' config: ${defaultError.message}`),\n ],\n };\n }\n // validatedDefault is properly typed from superstruct\n validConfig.default = validatedDefault;\n }\n\n // Step 3: Validate chain-specific configs, keeping valid ones\n for (const [key, value] of Object.entries(dataRecord)) {\n if (key === 'default') {\n continue;\n }\n\n // Check chain ID format\n if (!isValidChainIdKey(key)) {\n errors.push(\n new Error(\n `Invalid chain ID key \"${key}\". Expected hex string (e.g., \"0x1\") or CAIP-2 format (e.g., \"eip155:1\", \"solana:...\")`,\n ),\n );\n continue; // Skip this chain, don't add to result\n }\n\n // Validate chain config\n if (value !== undefined) {\n const [chainError, validatedChain] = validate(\n value,\n SmartTransactionsNetworkConfigSchema,\n );\n if (chainError) {\n errors.push(new Error(`Chain \"${key}\": ${chainError.message}`));\n continue; // Skip this chain, don't add to result\n }\n // validatedChain is properly typed from superstruct\n validConfig[key] = validatedChain;\n }\n }\n\n return { config: validConfig, errors };\n}\n\n/**\n * Validates that the given data conforms to the SmartTransactionsNetworkConfig schema.\n *\n * @param data - The data to validate\n * @returns True if the data is valid, false otherwise\n */\nexport function validateSmartTransactionsNetworkConfig(\n data: unknown,\n): data is SmartTransactionsNetworkConfigFromSchema {\n return is(data, SmartTransactionsNetworkConfigSchema);\n}\n"]}
@@ -0,0 +1,141 @@
1
+ import type { Infer } from "@metamask/superstruct";
2
+ /**
3
+ * Schema for validating per-network smart transactions configuration.
4
+ * All fields are optional to allow partial configuration and merging with defaults.
5
+ */
6
+ export declare const SmartTransactionsNetworkConfigSchema: import("@metamask/superstruct").Struct<{
7
+ extensionActive?: boolean | undefined;
8
+ mobileActive?: boolean | undefined;
9
+ mobileActiveIOS?: boolean | undefined;
10
+ mobileActiveAndroid?: boolean | undefined;
11
+ expectedDeadline?: number | undefined;
12
+ maxDeadline?: number | undefined;
13
+ extensionReturnTxHashAsap?: boolean | undefined;
14
+ extensionReturnTxHashAsapBatch?: boolean | undefined;
15
+ mobileReturnTxHashAsap?: boolean | undefined;
16
+ extensionSkipSmartTransactionStatusPage?: boolean | undefined;
17
+ batchStatusPollingInterval?: number | undefined;
18
+ sentinelUrl?: string | undefined;
19
+ }, {
20
+ /** Whether smart transactions are active for the extension client */
21
+ extensionActive: import("@metamask/superstruct").Struct<boolean | undefined, null>;
22
+ /** Whether smart transactions are active for mobile clients (generic) */
23
+ mobileActive: import("@metamask/superstruct").Struct<boolean | undefined, null>;
24
+ /** Whether smart transactions are active for iOS specifically */
25
+ mobileActiveIOS: import("@metamask/superstruct").Struct<boolean | undefined, null>;
26
+ /** Whether smart transactions are active for Android specifically */
27
+ mobileActiveAndroid: import("@metamask/superstruct").Struct<boolean | undefined, null>;
28
+ /** Expected time in seconds for a smart transaction to be mined */
29
+ expectedDeadline: import("@metamask/superstruct").Struct<number | undefined, null>;
30
+ /** Maximum time in seconds before a smart transaction is considered failed */
31
+ maxDeadline: import("@metamask/superstruct").Struct<number | undefined, null>;
32
+ /** Whether extension should return tx hash immediately without waiting for confirmation */
33
+ extensionReturnTxHashAsap: import("@metamask/superstruct").Struct<boolean | undefined, null>;
34
+ /** Whether extension should return tx hash immediately for batch transactions */
35
+ extensionReturnTxHashAsapBatch: import("@metamask/superstruct").Struct<boolean | undefined, null>;
36
+ /** Whether mobile should return tx hash immediately without waiting for confirmation */
37
+ mobileReturnTxHashAsap: import("@metamask/superstruct").Struct<boolean | undefined, null>;
38
+ /** Whether extension should skip the smart transaction status page */
39
+ extensionSkipSmartTransactionStatusPage: import("@metamask/superstruct").Struct<boolean | undefined, null>;
40
+ /** Polling interval in milliseconds for batch status updates */
41
+ batchStatusPollingInterval: import("@metamask/superstruct").Struct<number | undefined, null>;
42
+ /** Custom sentinel URL for the network */
43
+ sentinelUrl: import("@metamask/superstruct").Struct<string | undefined, null>;
44
+ }>;
45
+ /**
46
+ * Schema for validating the complete smart transactions feature flags configuration.
47
+ * This includes a default configuration and optional chain-specific overrides.
48
+ */
49
+ export declare const SmartTransactionsFeatureFlagsConfigSchema: import("@metamask/superstruct").Struct<{
50
+ default?: {
51
+ extensionActive?: boolean | undefined;
52
+ mobileActive?: boolean | undefined;
53
+ mobileActiveIOS?: boolean | undefined;
54
+ mobileActiveAndroid?: boolean | undefined;
55
+ expectedDeadline?: number | undefined;
56
+ maxDeadline?: number | undefined;
57
+ extensionReturnTxHashAsap?: boolean | undefined;
58
+ extensionReturnTxHashAsapBatch?: boolean | undefined;
59
+ mobileReturnTxHashAsap?: boolean | undefined;
60
+ extensionSkipSmartTransactionStatusPage?: boolean | undefined;
61
+ batchStatusPollingInterval?: number | undefined;
62
+ sentinelUrl?: string | undefined;
63
+ } | undefined;
64
+ }, {
65
+ /** Default configuration applied to all chains unless overridden */
66
+ default: import("@metamask/superstruct").Struct<{
67
+ extensionActive?: boolean | undefined;
68
+ mobileActive?: boolean | undefined;
69
+ mobileActiveIOS?: boolean | undefined;
70
+ mobileActiveAndroid?: boolean | undefined;
71
+ expectedDeadline?: number | undefined;
72
+ maxDeadline?: number | undefined;
73
+ extensionReturnTxHashAsap?: boolean | undefined;
74
+ extensionReturnTxHashAsapBatch?: boolean | undefined;
75
+ mobileReturnTxHashAsap?: boolean | undefined;
76
+ extensionSkipSmartTransactionStatusPage?: boolean | undefined;
77
+ batchStatusPollingInterval?: number | undefined;
78
+ sentinelUrl?: string | undefined;
79
+ } | undefined, {
80
+ /** Whether smart transactions are active for the extension client */
81
+ extensionActive: import("@metamask/superstruct").Struct<boolean | undefined, null>;
82
+ /** Whether smart transactions are active for mobile clients (generic) */
83
+ mobileActive: import("@metamask/superstruct").Struct<boolean | undefined, null>;
84
+ /** Whether smart transactions are active for iOS specifically */
85
+ mobileActiveIOS: import("@metamask/superstruct").Struct<boolean | undefined, null>;
86
+ /** Whether smart transactions are active for Android specifically */
87
+ mobileActiveAndroid: import("@metamask/superstruct").Struct<boolean | undefined, null>;
88
+ /** Expected time in seconds for a smart transaction to be mined */
89
+ expectedDeadline: import("@metamask/superstruct").Struct<number | undefined, null>;
90
+ /** Maximum time in seconds before a smart transaction is considered failed */
91
+ maxDeadline: import("@metamask/superstruct").Struct<number | undefined, null>;
92
+ /** Whether extension should return tx hash immediately without waiting for confirmation */
93
+ extensionReturnTxHashAsap: import("@metamask/superstruct").Struct<boolean | undefined, null>;
94
+ /** Whether extension should return tx hash immediately for batch transactions */
95
+ extensionReturnTxHashAsapBatch: import("@metamask/superstruct").Struct<boolean | undefined, null>;
96
+ /** Whether mobile should return tx hash immediately without waiting for confirmation */
97
+ mobileReturnTxHashAsap: import("@metamask/superstruct").Struct<boolean | undefined, null>;
98
+ /** Whether extension should skip the smart transaction status page */
99
+ extensionSkipSmartTransactionStatusPage: import("@metamask/superstruct").Struct<boolean | undefined, null>;
100
+ /** Polling interval in milliseconds for batch status updates */
101
+ batchStatusPollingInterval: import("@metamask/superstruct").Struct<number | undefined, null>;
102
+ /** Custom sentinel URL for the network */
103
+ sentinelUrl: import("@metamask/superstruct").Struct<string | undefined, null>;
104
+ }>;
105
+ }>;
106
+ /**
107
+ * Type inferred from the SmartTransactionsNetworkConfigSchema
108
+ */
109
+ export declare type SmartTransactionsNetworkConfigFromSchema = Infer<typeof SmartTransactionsNetworkConfigSchema>;
110
+ /**
111
+ * Type inferred from the SmartTransactionsFeatureFlagsConfigSchema
112
+ */
113
+ export declare type SmartTransactionsFeatureFlagsConfigFromSchema = Infer<typeof SmartTransactionsFeatureFlagsConfigSchema>;
114
+ /**
115
+ * Result of processing feature flags with collected validation errors.
116
+ * Uses per-chain validation: invalid chains are removed, valid ones are kept.
117
+ */
118
+ export declare type FeatureFlagsProcessResult = {
119
+ /** The validated configuration (may be partial if some chains were invalid) */
120
+ config: SmartTransactionsFeatureFlagsConfigFromSchema & Record<string, SmartTransactionsNetworkConfigFromSchema | undefined>;
121
+ /** Validation errors for invalid parts of the configuration */
122
+ errors: Error[];
123
+ };
124
+ /**
125
+ * Validates smart transactions feature flags with per-chain validation.
126
+ * - If the input is not an object, returns empty config with error
127
+ * - If `default` is present and invalid, returns empty config with error
128
+ * - For each chain: if invalid, removes it and collects error; if valid, includes it
129
+ *
130
+ * @param data - The data to validate
131
+ * @returns The validated config and any validation errors
132
+ */
133
+ export declare function validateSmartTransactionsFeatureFlags(data: unknown): FeatureFlagsProcessResult;
134
+ /**
135
+ * Validates that the given data conforms to the SmartTransactionsNetworkConfig schema.
136
+ *
137
+ * @param data - The data to validate
138
+ * @returns True if the data is valid, false otherwise
139
+ */
140
+ export declare function validateSmartTransactionsNetworkConfig(data: unknown): data is SmartTransactionsNetworkConfigFromSchema;
141
+ //# sourceMappingURL=validators.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.d.cts","sourceRoot":"","sources":["../../src/featureFlags/validators.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD;;;GAGG;AACH,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;IAC/C,qEAAqE;;IAErE,yEAAyE;;IAEzE,iEAAiE;;IAEjE,qEAAqE;;IAErE,mEAAmE;;IAEnE,8EAA8E;;IAE9E,2FAA2F;;IAE3F,iFAAiF;;IAEjF,wFAAwF;;IAExF,sEAAsE;;IAEtE,gEAAgE;;IAEhE,0CAA0C;;EAE1C,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,yCAAyC;;;;;;;;;;;;;;;;IACpD,oEAAoE;;;;;;;;;;;;;;;QA/BpE,qEAAqE;;QAErE,yEAAyE;;QAEzE,iEAAiE;;QAEjE,qEAAqE;;QAErE,mEAAmE;;QAEnE,8EAA8E;;QAE9E,2FAA2F;;QAE3F,iFAAiF;;QAEjF,wFAAwF;;QAExF,sEAAsE;;QAEtE,gEAAgE;;QAEhE,0CAA0C;;;EAW1C,CAAC;AAEH;;GAEG;AACH,oBAAY,wCAAwC,GAAG,KAAK,CAC1D,OAAO,oCAAoC,CAC5C,CAAC;AAEF;;GAEG;AACH,oBAAY,6CAA6C,GAAG,KAAK,CAC/D,OAAO,yCAAyC,CACjD,CAAC;AAEF;;;GAGG;AACH,oBAAY,yBAAyB,GAAG;IACtC,+EAA+E;IAC/E,MAAM,EAAE,6CAA6C,GACnD,MAAM,CAAC,MAAM,EAAE,wCAAwC,GAAG,SAAS,CAAC,CAAC;IACvE,+DAA+D;IAC/D,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,qCAAqC,CACnD,IAAI,EAAE,OAAO,GACZ,yBAAyB,CAsE3B;AAED;;;;;GAKG;AACH,wBAAgB,sCAAsC,CACpD,IAAI,EAAE,OAAO,GACZ,IAAI,IAAI,wCAAwC,CAElD"}
@@ -0,0 +1,141 @@
1
+ import type { Infer } from "@metamask/superstruct";
2
+ /**
3
+ * Schema for validating per-network smart transactions configuration.
4
+ * All fields are optional to allow partial configuration and merging with defaults.
5
+ */
6
+ export declare const SmartTransactionsNetworkConfigSchema: import("@metamask/superstruct").Struct<{
7
+ extensionActive?: boolean | undefined;
8
+ mobileActive?: boolean | undefined;
9
+ mobileActiveIOS?: boolean | undefined;
10
+ mobileActiveAndroid?: boolean | undefined;
11
+ expectedDeadline?: number | undefined;
12
+ maxDeadline?: number | undefined;
13
+ extensionReturnTxHashAsap?: boolean | undefined;
14
+ extensionReturnTxHashAsapBatch?: boolean | undefined;
15
+ mobileReturnTxHashAsap?: boolean | undefined;
16
+ extensionSkipSmartTransactionStatusPage?: boolean | undefined;
17
+ batchStatusPollingInterval?: number | undefined;
18
+ sentinelUrl?: string | undefined;
19
+ }, {
20
+ /** Whether smart transactions are active for the extension client */
21
+ extensionActive: import("@metamask/superstruct").Struct<boolean | undefined, null>;
22
+ /** Whether smart transactions are active for mobile clients (generic) */
23
+ mobileActive: import("@metamask/superstruct").Struct<boolean | undefined, null>;
24
+ /** Whether smart transactions are active for iOS specifically */
25
+ mobileActiveIOS: import("@metamask/superstruct").Struct<boolean | undefined, null>;
26
+ /** Whether smart transactions are active for Android specifically */
27
+ mobileActiveAndroid: import("@metamask/superstruct").Struct<boolean | undefined, null>;
28
+ /** Expected time in seconds for a smart transaction to be mined */
29
+ expectedDeadline: import("@metamask/superstruct").Struct<number | undefined, null>;
30
+ /** Maximum time in seconds before a smart transaction is considered failed */
31
+ maxDeadline: import("@metamask/superstruct").Struct<number | undefined, null>;
32
+ /** Whether extension should return tx hash immediately without waiting for confirmation */
33
+ extensionReturnTxHashAsap: import("@metamask/superstruct").Struct<boolean | undefined, null>;
34
+ /** Whether extension should return tx hash immediately for batch transactions */
35
+ extensionReturnTxHashAsapBatch: import("@metamask/superstruct").Struct<boolean | undefined, null>;
36
+ /** Whether mobile should return tx hash immediately without waiting for confirmation */
37
+ mobileReturnTxHashAsap: import("@metamask/superstruct").Struct<boolean | undefined, null>;
38
+ /** Whether extension should skip the smart transaction status page */
39
+ extensionSkipSmartTransactionStatusPage: import("@metamask/superstruct").Struct<boolean | undefined, null>;
40
+ /** Polling interval in milliseconds for batch status updates */
41
+ batchStatusPollingInterval: import("@metamask/superstruct").Struct<number | undefined, null>;
42
+ /** Custom sentinel URL for the network */
43
+ sentinelUrl: import("@metamask/superstruct").Struct<string | undefined, null>;
44
+ }>;
45
+ /**
46
+ * Schema for validating the complete smart transactions feature flags configuration.
47
+ * This includes a default configuration and optional chain-specific overrides.
48
+ */
49
+ export declare const SmartTransactionsFeatureFlagsConfigSchema: import("@metamask/superstruct").Struct<{
50
+ default?: {
51
+ extensionActive?: boolean | undefined;
52
+ mobileActive?: boolean | undefined;
53
+ mobileActiveIOS?: boolean | undefined;
54
+ mobileActiveAndroid?: boolean | undefined;
55
+ expectedDeadline?: number | undefined;
56
+ maxDeadline?: number | undefined;
57
+ extensionReturnTxHashAsap?: boolean | undefined;
58
+ extensionReturnTxHashAsapBatch?: boolean | undefined;
59
+ mobileReturnTxHashAsap?: boolean | undefined;
60
+ extensionSkipSmartTransactionStatusPage?: boolean | undefined;
61
+ batchStatusPollingInterval?: number | undefined;
62
+ sentinelUrl?: string | undefined;
63
+ } | undefined;
64
+ }, {
65
+ /** Default configuration applied to all chains unless overridden */
66
+ default: import("@metamask/superstruct").Struct<{
67
+ extensionActive?: boolean | undefined;
68
+ mobileActive?: boolean | undefined;
69
+ mobileActiveIOS?: boolean | undefined;
70
+ mobileActiveAndroid?: boolean | undefined;
71
+ expectedDeadline?: number | undefined;
72
+ maxDeadline?: number | undefined;
73
+ extensionReturnTxHashAsap?: boolean | undefined;
74
+ extensionReturnTxHashAsapBatch?: boolean | undefined;
75
+ mobileReturnTxHashAsap?: boolean | undefined;
76
+ extensionSkipSmartTransactionStatusPage?: boolean | undefined;
77
+ batchStatusPollingInterval?: number | undefined;
78
+ sentinelUrl?: string | undefined;
79
+ } | undefined, {
80
+ /** Whether smart transactions are active for the extension client */
81
+ extensionActive: import("@metamask/superstruct").Struct<boolean | undefined, null>;
82
+ /** Whether smart transactions are active for mobile clients (generic) */
83
+ mobileActive: import("@metamask/superstruct").Struct<boolean | undefined, null>;
84
+ /** Whether smart transactions are active for iOS specifically */
85
+ mobileActiveIOS: import("@metamask/superstruct").Struct<boolean | undefined, null>;
86
+ /** Whether smart transactions are active for Android specifically */
87
+ mobileActiveAndroid: import("@metamask/superstruct").Struct<boolean | undefined, null>;
88
+ /** Expected time in seconds for a smart transaction to be mined */
89
+ expectedDeadline: import("@metamask/superstruct").Struct<number | undefined, null>;
90
+ /** Maximum time in seconds before a smart transaction is considered failed */
91
+ maxDeadline: import("@metamask/superstruct").Struct<number | undefined, null>;
92
+ /** Whether extension should return tx hash immediately without waiting for confirmation */
93
+ extensionReturnTxHashAsap: import("@metamask/superstruct").Struct<boolean | undefined, null>;
94
+ /** Whether extension should return tx hash immediately for batch transactions */
95
+ extensionReturnTxHashAsapBatch: import("@metamask/superstruct").Struct<boolean | undefined, null>;
96
+ /** Whether mobile should return tx hash immediately without waiting for confirmation */
97
+ mobileReturnTxHashAsap: import("@metamask/superstruct").Struct<boolean | undefined, null>;
98
+ /** Whether extension should skip the smart transaction status page */
99
+ extensionSkipSmartTransactionStatusPage: import("@metamask/superstruct").Struct<boolean | undefined, null>;
100
+ /** Polling interval in milliseconds for batch status updates */
101
+ batchStatusPollingInterval: import("@metamask/superstruct").Struct<number | undefined, null>;
102
+ /** Custom sentinel URL for the network */
103
+ sentinelUrl: import("@metamask/superstruct").Struct<string | undefined, null>;
104
+ }>;
105
+ }>;
106
+ /**
107
+ * Type inferred from the SmartTransactionsNetworkConfigSchema
108
+ */
109
+ export declare type SmartTransactionsNetworkConfigFromSchema = Infer<typeof SmartTransactionsNetworkConfigSchema>;
110
+ /**
111
+ * Type inferred from the SmartTransactionsFeatureFlagsConfigSchema
112
+ */
113
+ export declare type SmartTransactionsFeatureFlagsConfigFromSchema = Infer<typeof SmartTransactionsFeatureFlagsConfigSchema>;
114
+ /**
115
+ * Result of processing feature flags with collected validation errors.
116
+ * Uses per-chain validation: invalid chains are removed, valid ones are kept.
117
+ */
118
+ export declare type FeatureFlagsProcessResult = {
119
+ /** The validated configuration (may be partial if some chains were invalid) */
120
+ config: SmartTransactionsFeatureFlagsConfigFromSchema & Record<string, SmartTransactionsNetworkConfigFromSchema | undefined>;
121
+ /** Validation errors for invalid parts of the configuration */
122
+ errors: Error[];
123
+ };
124
+ /**
125
+ * Validates smart transactions feature flags with per-chain validation.
126
+ * - If the input is not an object, returns empty config with error
127
+ * - If `default` is present and invalid, returns empty config with error
128
+ * - For each chain: if invalid, removes it and collects error; if valid, includes it
129
+ *
130
+ * @param data - The data to validate
131
+ * @returns The validated config and any validation errors
132
+ */
133
+ export declare function validateSmartTransactionsFeatureFlags(data: unknown): FeatureFlagsProcessResult;
134
+ /**
135
+ * Validates that the given data conforms to the SmartTransactionsNetworkConfig schema.
136
+ *
137
+ * @param data - The data to validate
138
+ * @returns True if the data is valid, false otherwise
139
+ */
140
+ export declare function validateSmartTransactionsNetworkConfig(data: unknown): data is SmartTransactionsNetworkConfigFromSchema;
141
+ //# sourceMappingURL=validators.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.d.mts","sourceRoot":"","sources":["../../src/featureFlags/validators.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AAcnD;;;GAGG;AACH,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;IAC/C,qEAAqE;;IAErE,yEAAyE;;IAEzE,iEAAiE;;IAEjE,qEAAqE;;IAErE,mEAAmE;;IAEnE,8EAA8E;;IAE9E,2FAA2F;;IAE3F,iFAAiF;;IAEjF,wFAAwF;;IAExF,sEAAsE;;IAEtE,gEAAgE;;IAEhE,0CAA0C;;EAE1C,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,yCAAyC;;;;;;;;;;;;;;;;IACpD,oEAAoE;;;;;;;;;;;;;;;QA/BpE,qEAAqE;;QAErE,yEAAyE;;QAEzE,iEAAiE;;QAEjE,qEAAqE;;QAErE,mEAAmE;;QAEnE,8EAA8E;;QAE9E,2FAA2F;;QAE3F,iFAAiF;;QAEjF,wFAAwF;;QAExF,sEAAsE;;QAEtE,gEAAgE;;QAEhE,0CAA0C;;;EAW1C,CAAC;AAEH;;GAEG;AACH,oBAAY,wCAAwC,GAAG,KAAK,CAC1D,OAAO,oCAAoC,CAC5C,CAAC;AAEF;;GAEG;AACH,oBAAY,6CAA6C,GAAG,KAAK,CAC/D,OAAO,yCAAyC,CACjD,CAAC;AAEF;;;GAGG;AACH,oBAAY,yBAAyB,GAAG;IACtC,+EAA+E;IAC/E,MAAM,EAAE,6CAA6C,GACnD,MAAM,CAAC,MAAM,EAAE,wCAAwC,GAAG,SAAS,CAAC,CAAC;IACvE,+DAA+D;IAC/D,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,qCAAqC,CACnD,IAAI,EAAE,OAAO,GACZ,yBAAyB,CAsE3B;AAED;;;;;GAKG;AACH,wBAAgB,sCAAsC,CACpD,IAAI,EAAE,OAAO,GACZ,IAAI,IAAI,wCAAwC,CAElD"}
@@ -0,0 +1,121 @@
1
+ import { boolean, number, optional, string, type, is, validate } from "@metamask/superstruct";
2
+ import { isCaipChainId, isStrictHexString } from "@metamask/utils";
3
+ /**
4
+ * Validates that a key is a valid chain ID (hex or CAIP-2 format).
5
+ * Supports both EVM hex chain IDs and chain-agnostic CAIP-2 identifiers.
6
+ *
7
+ * @param key - The key to validate
8
+ * @returns True if the key is a valid chain ID format
9
+ */
10
+ function isValidChainIdKey(key) {
11
+ return isStrictHexString(key) || isCaipChainId(key);
12
+ }
13
+ /**
14
+ * Schema for validating per-network smart transactions configuration.
15
+ * All fields are optional to allow partial configuration and merging with defaults.
16
+ */
17
+ export const SmartTransactionsNetworkConfigSchema = type({
18
+ /** Whether smart transactions are active for the extension client */
19
+ extensionActive: optional(boolean()),
20
+ /** Whether smart transactions are active for mobile clients (generic) */
21
+ mobileActive: optional(boolean()),
22
+ /** Whether smart transactions are active for iOS specifically */
23
+ mobileActiveIOS: optional(boolean()),
24
+ /** Whether smart transactions are active for Android specifically */
25
+ mobileActiveAndroid: optional(boolean()),
26
+ /** Expected time in seconds for a smart transaction to be mined */
27
+ expectedDeadline: optional(number()),
28
+ /** Maximum time in seconds before a smart transaction is considered failed */
29
+ maxDeadline: optional(number()),
30
+ /** Whether extension should return tx hash immediately without waiting for confirmation */
31
+ extensionReturnTxHashAsap: optional(boolean()),
32
+ /** Whether extension should return tx hash immediately for batch transactions */
33
+ extensionReturnTxHashAsapBatch: optional(boolean()),
34
+ /** Whether mobile should return tx hash immediately without waiting for confirmation */
35
+ mobileReturnTxHashAsap: optional(boolean()),
36
+ /** Whether extension should skip the smart transaction status page */
37
+ extensionSkipSmartTransactionStatusPage: optional(boolean()),
38
+ /** Polling interval in milliseconds for batch status updates */
39
+ batchStatusPollingInterval: optional(number()),
40
+ /** Custom sentinel URL for the network */
41
+ sentinelUrl: optional(string()),
42
+ });
43
+ /**
44
+ * Schema for validating the complete smart transactions feature flags configuration.
45
+ * This includes a default configuration and optional chain-specific overrides.
46
+ */
47
+ export const SmartTransactionsFeatureFlagsConfigSchema = type({
48
+ /** Default configuration applied to all chains unless overridden */
49
+ default: optional(SmartTransactionsNetworkConfigSchema),
50
+ });
51
+ /**
52
+ * Validates smart transactions feature flags with per-chain validation.
53
+ * - If the input is not an object, returns empty config with error
54
+ * - If `default` is present and invalid, returns empty config with error
55
+ * - For each chain: if invalid, removes it and collects error; if valid, includes it
56
+ *
57
+ * @param data - The data to validate
58
+ * @returns The validated config and any validation errors
59
+ */
60
+ export function validateSmartTransactionsFeatureFlags(data) {
61
+ const errors = [];
62
+ // Step 1: Check if it's a valid object
63
+ if (typeof data !== 'object' || data === null || Array.isArray(data)) {
64
+ const typeDescription = data === null ? 'null' : typeof data;
65
+ const arraySuffix = Array.isArray(data) ? ' (array)' : '';
66
+ return {
67
+ config: {},
68
+ errors: [
69
+ new Error(`Expected an object, received ${typeDescription}${arraySuffix}`),
70
+ ],
71
+ };
72
+ }
73
+ const dataRecord = data;
74
+ const validConfig = {};
75
+ // Step 2: Validate 'default' - if present and invalid, reject everything
76
+ if (dataRecord.default !== undefined) {
77
+ const [defaultError, validatedDefault] = validate(dataRecord.default, SmartTransactionsNetworkConfigSchema);
78
+ if (defaultError) {
79
+ return {
80
+ config: {},
81
+ errors: [
82
+ new Error(`Invalid 'default' config: ${defaultError.message}`),
83
+ ],
84
+ };
85
+ }
86
+ // validatedDefault is properly typed from superstruct
87
+ validConfig.default = validatedDefault;
88
+ }
89
+ // Step 3: Validate chain-specific configs, keeping valid ones
90
+ for (const [key, value] of Object.entries(dataRecord)) {
91
+ if (key === 'default') {
92
+ continue;
93
+ }
94
+ // Check chain ID format
95
+ if (!isValidChainIdKey(key)) {
96
+ errors.push(new Error(`Invalid chain ID key "${key}". Expected hex string (e.g., "0x1") or CAIP-2 format (e.g., "eip155:1", "solana:...")`));
97
+ continue; // Skip this chain, don't add to result
98
+ }
99
+ // Validate chain config
100
+ if (value !== undefined) {
101
+ const [chainError, validatedChain] = validate(value, SmartTransactionsNetworkConfigSchema);
102
+ if (chainError) {
103
+ errors.push(new Error(`Chain "${key}": ${chainError.message}`));
104
+ continue; // Skip this chain, don't add to result
105
+ }
106
+ // validatedChain is properly typed from superstruct
107
+ validConfig[key] = validatedChain;
108
+ }
109
+ }
110
+ return { config: validConfig, errors };
111
+ }
112
+ /**
113
+ * Validates that the given data conforms to the SmartTransactionsNetworkConfig schema.
114
+ *
115
+ * @param data - The data to validate
116
+ * @returns True if the data is valid, false otherwise
117
+ */
118
+ export function validateSmartTransactionsNetworkConfig(data) {
119
+ return is(data, SmartTransactionsNetworkConfigSchema);
120
+ }
121
+ //# sourceMappingURL=validators.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.mjs","sourceRoot":"","sources":["../../src/featureFlags/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,EAAE,EACF,QAAQ,EACT,8BAA8B;AAE/B,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,wBAAwB;AAEnE;;;;;;GAMG;AACH,SAAS,iBAAiB,CAAC,GAAW;IACpC,OAAO,iBAAiB,CAAC,GAAG,CAAC,IAAI,aAA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,IAAI,KAAK,KAAK,SAAS,EAAE;YACvB,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,GAAG,QAAQ,CAC3C,KAAK,EACL,oCAAoC,CACrC,CAAC;YACF,IAAI,UAAU,EAAE;gBACd,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,UAAU,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;gBAChE,SAAS,CAAC,uCAAuC;aAClD;YACD,oDAAoD;YACpD,WAAW,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC;SACnC;KACF;IAED,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;AACzC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sCAAsC,CACpD,IAAa;IAEb,OAAO,EAAE,CAAC,IAAI,EAAE,oCAAoC,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import {\n boolean,\n number,\n optional,\n string,\n type,\n is,\n validate,\n} from '@metamask/superstruct';\nimport type { Infer } from '@metamask/superstruct';\nimport { isCaipChainId, isStrictHexString } from '@metamask/utils';\n\n/**\n * Validates that a key is a valid chain ID (hex or CAIP-2 format).\n * Supports both EVM hex chain IDs and chain-agnostic CAIP-2 identifiers.\n *\n * @param key - The key to validate\n * @returns True if the key is a valid chain ID format\n */\nfunction isValidChainIdKey(key: string): boolean {\n return isStrictHexString(key) || isCaipChainId(key);\n}\n\n/**\n * Schema for validating per-network smart transactions configuration.\n * All fields are optional to allow partial configuration and merging with defaults.\n */\nexport const SmartTransactionsNetworkConfigSchema = type({\n /** Whether smart transactions are active for the extension client */\n extensionActive: optional(boolean()),\n /** Whether smart transactions are active for mobile clients (generic) */\n mobileActive: optional(boolean()),\n /** Whether smart transactions are active for iOS specifically */\n mobileActiveIOS: optional(boolean()),\n /** Whether smart transactions are active for Android specifically */\n mobileActiveAndroid: optional(boolean()),\n /** Expected time in seconds for a smart transaction to be mined */\n expectedDeadline: optional(number()),\n /** Maximum time in seconds before a smart transaction is considered failed */\n maxDeadline: optional(number()),\n /** Whether extension should return tx hash immediately without waiting for confirmation */\n extensionReturnTxHashAsap: optional(boolean()),\n /** Whether extension should return tx hash immediately for batch transactions */\n extensionReturnTxHashAsapBatch: optional(boolean()),\n /** Whether mobile should return tx hash immediately without waiting for confirmation */\n mobileReturnTxHashAsap: optional(boolean()),\n /** Whether extension should skip the smart transaction status page */\n extensionSkipSmartTransactionStatusPage: optional(boolean()),\n /** Polling interval in milliseconds for batch status updates */\n batchStatusPollingInterval: optional(number()),\n /** Custom sentinel URL for the network */\n sentinelUrl: optional(string()),\n});\n\n/**\n * Schema for validating the complete smart transactions feature flags configuration.\n * This includes a default configuration and optional chain-specific overrides.\n */\nexport const SmartTransactionsFeatureFlagsConfigSchema = type({\n /** Default configuration applied to all chains unless overridden */\n default: optional(SmartTransactionsNetworkConfigSchema),\n});\n\n/**\n * Type inferred from the SmartTransactionsNetworkConfigSchema\n */\nexport type SmartTransactionsNetworkConfigFromSchema = Infer<\n typeof SmartTransactionsNetworkConfigSchema\n>;\n\n/**\n * Type inferred from the SmartTransactionsFeatureFlagsConfigSchema\n */\nexport type SmartTransactionsFeatureFlagsConfigFromSchema = Infer<\n typeof SmartTransactionsFeatureFlagsConfigSchema\n>;\n\n/**\n * Result of processing feature flags with collected validation errors.\n * Uses per-chain validation: invalid chains are removed, valid ones are kept.\n */\nexport type FeatureFlagsProcessResult = {\n /** The validated configuration (may be partial if some chains were invalid) */\n config: SmartTransactionsFeatureFlagsConfigFromSchema &\n Record<string, SmartTransactionsNetworkConfigFromSchema | undefined>;\n /** Validation errors for invalid parts of the configuration */\n errors: Error[];\n};\n\n/**\n * Validates smart transactions feature flags with per-chain validation.\n * - If the input is not an object, returns empty config with error\n * - If `default` is present and invalid, returns empty config with error\n * - For each chain: if invalid, removes it and collects error; if valid, includes it\n *\n * @param data - The data to validate\n * @returns The validated config and any validation errors\n */\nexport function validateSmartTransactionsFeatureFlags(\n data: unknown,\n): FeatureFlagsProcessResult {\n const errors: Error[] = [];\n\n // Step 1: Check if it's a valid object\n if (typeof data !== 'object' || data === null || Array.isArray(data)) {\n const typeDescription = data === null ? 'null' : typeof data;\n const arraySuffix = Array.isArray(data) ? ' (array)' : '';\n return {\n config: {},\n errors: [\n new Error(\n `Expected an object, received ${typeDescription}${arraySuffix}`,\n ),\n ],\n };\n }\n\n const dataRecord = data as Record<string, unknown>;\n const validConfig: FeatureFlagsProcessResult['config'] = {};\n\n // Step 2: Validate 'default' - if present and invalid, reject everything\n if (dataRecord.default !== undefined) {\n const [defaultError, validatedDefault] = validate(\n dataRecord.default,\n SmartTransactionsNetworkConfigSchema,\n );\n if (defaultError) {\n return {\n config: {},\n errors: [\n new Error(`Invalid 'default' config: ${defaultError.message}`),\n ],\n };\n }\n // validatedDefault is properly typed from superstruct\n validConfig.default = validatedDefault;\n }\n\n // Step 3: Validate chain-specific configs, keeping valid ones\n for (const [key, value] of Object.entries(dataRecord)) {\n if (key === 'default') {\n continue;\n }\n\n // Check chain ID format\n if (!isValidChainIdKey(key)) {\n errors.push(\n new Error(\n `Invalid chain ID key \"${key}\". Expected hex string (e.g., \"0x1\") or CAIP-2 format (e.g., \"eip155:1\", \"solana:...\")`,\n ),\n );\n continue; // Skip this chain, don't add to result\n }\n\n // Validate chain config\n if (value !== undefined) {\n const [chainError, validatedChain] = validate(\n value,\n SmartTransactionsNetworkConfigSchema,\n );\n if (chainError) {\n errors.push(new Error(`Chain \"${key}\": ${chainError.message}`));\n continue; // Skip this chain, don't add to result\n }\n // validatedChain is properly typed from superstruct\n validConfig[key] = validatedChain;\n }\n }\n\n return { config: validConfig, errors };\n}\n\n/**\n * Validates that the given data conforms to the SmartTransactionsNetworkConfig schema.\n *\n * @param data - The data to validate\n * @returns True if the data is valid, false otherwise\n */\nexport function validateSmartTransactionsNetworkConfig(\n data: unknown,\n): data is SmartTransactionsNetworkConfigFromSchema {\n return is(data, SmartTransactionsNetworkConfigSchema);\n}\n"]}
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSmartTransactionMetricsSensitiveProperties = exports.getSmartTransactionMetricsProperties = exports.MetaMetricsEventCategory = exports.MetaMetricsEventName = exports.ClientId = exports.SmartTransactionStatuses = exports.SmartTransactionCancellationReason = exports.SmartTransactionMinedTx = exports.SmartTransactionsController = void 0;
3
+ exports.selectSmartTransactionsFeatureFlagsForChain = exports.selectSmartTransactionsFeatureFlags = exports.getSmartTransactionMetricsSensitiveProperties = exports.getSmartTransactionMetricsProperties = exports.MetaMetricsEventCategory = exports.MetaMetricsEventName = exports.ClientId = exports.SmartTransactionStatuses = exports.SmartTransactionCancellationReason = exports.SmartTransactionMinedTx = exports.SmartTransactionsController = void 0;
4
4
  var SmartTransactionsController_1 = require("./SmartTransactionsController.cjs");
5
5
  Object.defineProperty(exports, "SmartTransactionsController", { enumerable: true, get: function () { return SmartTransactionsController_1.SmartTransactionsController; } });
6
6
  var types_1 = require("./types.cjs");
@@ -14,4 +14,8 @@ Object.defineProperty(exports, "MetaMetricsEventCategory", { enumerable: true, g
14
14
  var utils_1 = require("./utils.cjs");
15
15
  Object.defineProperty(exports, "getSmartTransactionMetricsProperties", { enumerable: true, get: function () { return utils_1.getSmartTransactionMetricsProperties; } });
16
16
  Object.defineProperty(exports, "getSmartTransactionMetricsSensitiveProperties", { enumerable: true, get: function () { return utils_1.getSmartTransactionMetricsSensitiveProperties; } });
17
+ // Feature flag selectors
18
+ var selectors_1 = require("./selectors.cjs");
19
+ Object.defineProperty(exports, "selectSmartTransactionsFeatureFlags", { enumerable: true, get: function () { return selectors_1.selectSmartTransactionsFeatureFlags; } });
20
+ Object.defineProperty(exports, "selectSmartTransactionsFeatureFlagsForChain", { enumerable: true, get: function () { return selectors_1.selectSmartTransactionsFeatureFlagsForChain; } });
17
21
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iFAA4E;AAAnE,0IAAA,2BAA2B,OAAA;AAWpC,qCAUiB;AAJf,gHAAA,uBAAuB,OAAA;AACvB,2HAAA,kCAAkC,OAAA;AAClC,iHAAA,wBAAwB,OAAA;AACxB,iGAAA,QAAQ,OAAA;AAEV,6CAA6E;AAApE,iHAAA,oBAAoB,OAAA;AAAE,qHAAA,wBAAwB,OAAA;AACvD,qCAGiB;AAFf,6HAAA,oCAAoC,OAAA;AACpC,sIAAA,6CAA6C,OAAA","sourcesContent":["export { SmartTransactionsController } from './SmartTransactionsController';\nexport type {\n SmartTransactionsControllerMessenger,\n SmartTransactionsControllerState,\n SmartTransactionsControllerGetStateAction,\n SmartTransactionsControllerActions,\n SmartTransactionsControllerStateChangeEvent,\n SmartTransactionsControllerSmartTransactionEvent,\n SmartTransactionsControllerSmartTransactionConfirmationDoneEvent,\n SmartTransactionsControllerEvents,\n} from './SmartTransactionsController';\nexport {\n type Fee,\n type Fees,\n type IndividualTxFees,\n type FeatureFlags,\n type SmartTransaction,\n SmartTransactionMinedTx,\n SmartTransactionCancellationReason,\n SmartTransactionStatuses,\n ClientId,\n} from './types';\nexport { MetaMetricsEventName, MetaMetricsEventCategory } from './constants';\nexport {\n getSmartTransactionMetricsProperties,\n getSmartTransactionMetricsSensitiveProperties,\n} from './utils';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iFAA4E;AAAnE,0IAAA,2BAA2B,OAAA;AAWpC,qCAYiB;AAJf,gHAAA,uBAAuB,OAAA;AACvB,2HAAA,kCAAkC,OAAA;AAClC,iHAAA,wBAAwB,OAAA;AACxB,iGAAA,QAAQ,OAAA;AAEV,6CAA6E;AAApE,iHAAA,oBAAoB,OAAA;AAAE,qHAAA,wBAAwB,OAAA;AACvD,qCAGiB;AAFf,6HAAA,oCAAoC,OAAA;AACpC,sIAAA,6CAA6C,OAAA;AAG/C,yBAAyB;AACzB,6CAIqB;AAHnB,gIAAA,mCAAmC,OAAA;AACnC,wIAAA,2CAA2C,OAAA","sourcesContent":["export { SmartTransactionsController } from './SmartTransactionsController';\nexport type {\n SmartTransactionsControllerMessenger,\n SmartTransactionsControllerState,\n SmartTransactionsControllerGetStateAction,\n SmartTransactionsControllerActions,\n SmartTransactionsControllerStateChangeEvent,\n SmartTransactionsControllerSmartTransactionEvent,\n SmartTransactionsControllerSmartTransactionConfirmationDoneEvent,\n SmartTransactionsControllerEvents,\n} from './SmartTransactionsController';\nexport {\n type Fee,\n type Fees,\n type IndividualTxFees,\n type FeatureFlags,\n type SmartTransaction,\n type SmartTransactionsNetworkConfig,\n type SmartTransactionsFeatureFlagsConfig,\n SmartTransactionMinedTx,\n SmartTransactionCancellationReason,\n SmartTransactionStatuses,\n ClientId,\n} from './types';\nexport { MetaMetricsEventName, MetaMetricsEventCategory } from './constants';\nexport {\n getSmartTransactionMetricsProperties,\n getSmartTransactionMetricsSensitiveProperties,\n} from './utils';\n\n// Feature flag selectors\nexport {\n selectSmartTransactionsFeatureFlags,\n selectSmartTransactionsFeatureFlagsForChain,\n type SmartTransactionsFeatureFlagsState,\n} from './selectors';\n"]}
package/dist/index.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { SmartTransactionsController } from "./SmartTransactionsController.cjs";
2
2
  export type { SmartTransactionsControllerMessenger, SmartTransactionsControllerState, SmartTransactionsControllerGetStateAction, SmartTransactionsControllerActions, SmartTransactionsControllerStateChangeEvent, SmartTransactionsControllerSmartTransactionEvent, SmartTransactionsControllerSmartTransactionConfirmationDoneEvent, SmartTransactionsControllerEvents, } from "./SmartTransactionsController.cjs";
3
- export { type Fee, type Fees, type IndividualTxFees, type FeatureFlags, type SmartTransaction, SmartTransactionMinedTx, SmartTransactionCancellationReason, SmartTransactionStatuses, ClientId, } from "./types.cjs";
3
+ export { type Fee, type Fees, type IndividualTxFees, type FeatureFlags, type SmartTransaction, type SmartTransactionsNetworkConfig, type SmartTransactionsFeatureFlagsConfig, SmartTransactionMinedTx, SmartTransactionCancellationReason, SmartTransactionStatuses, ClientId, } from "./types.cjs";
4
4
  export { MetaMetricsEventName, MetaMetricsEventCategory } from "./constants.cjs";
5
5
  export { getSmartTransactionMetricsProperties, getSmartTransactionMetricsSensitiveProperties, } from "./utils.cjs";
6
+ export { selectSmartTransactionsFeatureFlags, selectSmartTransactionsFeatureFlagsForChain, type SmartTransactionsFeatureFlagsState, } from "./selectors.cjs";
6
7
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,0CAAsC;AAC5E,YAAY,EACV,oCAAoC,EACpC,gCAAgC,EAChC,yCAAyC,EACzC,kCAAkC,EAClC,2CAA2C,EAC3C,gDAAgD,EAChD,gEAAgE,EAChE,iCAAiC,GAClC,0CAAsC;AACvC,OAAO,EACL,KAAK,GAAG,EACR,KAAK,IAAI,EACT,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,uBAAuB,EACvB,kCAAkC,EAClC,wBAAwB,EACxB,QAAQ,GACT,oBAAgB;AACjB,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,wBAAoB;AAC7E,OAAO,EACL,oCAAoC,EACpC,6CAA6C,GAC9C,oBAAgB"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,0CAAsC;AAC5E,YAAY,EACV,oCAAoC,EACpC,gCAAgC,EAChC,yCAAyC,EACzC,kCAAkC,EAClC,2CAA2C,EAC3C,gDAAgD,EAChD,gEAAgE,EAChE,iCAAiC,GAClC,0CAAsC;AACvC,OAAO,EACL,KAAK,GAAG,EACR,KAAK,IAAI,EACT,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,8BAA8B,EACnC,KAAK,mCAAmC,EACxC,uBAAuB,EACvB,kCAAkC,EAClC,wBAAwB,EACxB,QAAQ,GACT,oBAAgB;AACjB,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,wBAAoB;AAC7E,OAAO,EACL,oCAAoC,EACpC,6CAA6C,GAC9C,oBAAgB;AAGjB,OAAO,EACL,mCAAmC,EACnC,2CAA2C,EAC3C,KAAK,kCAAkC,GACxC,wBAAoB"}