@metamask-previews/logging-controller 6.0.0-preview-9edcf0e0 → 6.0.0-preview-9d310688
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/dist/LoggingController.cjs +75 -0
- package/dist/LoggingController.cjs.map +1 -0
- package/dist/{types/LoggingController.d.ts → LoggingController.d.cts} +4 -4
- package/dist/LoggingController.d.cts.map +1 -0
- package/dist/LoggingController.d.mts +65 -0
- package/dist/LoggingController.d.mts.map +1 -0
- package/dist/LoggingController.mjs +69 -6
- package/dist/LoggingController.mjs.map +1 -1
- package/dist/index.cjs +19 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -19
- package/dist/index.mjs.map +1 -1
- package/dist/logTypes/EthSignLog.cjs +23 -0
- package/dist/logTypes/EthSignLog.cjs.map +1 -0
- package/dist/{types/logTypes/EthSignLog.d.ts → logTypes/EthSignLog.d.cts} +2 -2
- package/dist/logTypes/EthSignLog.d.cts.map +1 -0
- package/dist/logTypes/EthSignLog.d.mts +33 -0
- package/dist/logTypes/EthSignLog.d.mts.map +1 -0
- package/dist/logTypes/EthSignLog.mjs +19 -9
- package/dist/logTypes/EthSignLog.mjs.map +1 -1
- package/dist/logTypes/GenericLog.cjs +3 -0
- package/dist/logTypes/GenericLog.cjs.map +1 -0
- package/dist/logTypes/GenericLog.d.cts +6 -0
- package/dist/logTypes/GenericLog.d.cts.map +1 -0
- package/dist/logTypes/GenericLog.d.mts +6 -0
- package/dist/logTypes/GenericLog.d.mts.map +1 -0
- package/dist/logTypes/GenericLog.mjs +1 -1
- package/dist/logTypes/GenericLog.mjs.map +1 -1
- package/dist/logTypes/LogType.cjs +14 -0
- package/dist/logTypes/LogType.cjs.map +1 -0
- package/dist/{types/logTypes/LogType.d.ts → logTypes/LogType.d.cts} +1 -1
- package/dist/logTypes/LogType.d.cts.map +1 -0
- package/dist/logTypes/LogType.d.mts +10 -0
- package/dist/logTypes/LogType.d.mts.map +1 -0
- package/dist/logTypes/LogType.mjs +10 -7
- package/dist/logTypes/LogType.mjs.map +1 -1
- package/dist/logTypes/index.cjs +23 -0
- package/dist/logTypes/index.cjs.map +1 -0
- package/dist/logTypes/index.d.cts +13 -0
- package/dist/logTypes/index.d.cts.map +1 -0
- package/dist/logTypes/index.d.mts +13 -0
- package/dist/logTypes/index.d.mts.map +1 -0
- package/dist/logTypes/index.mjs +6 -15
- package/dist/logTypes/index.mjs.map +1 -1
- package/package.json +12 -7
- package/dist/LoggingController.js +0 -8
- package/dist/LoggingController.js.map +0 -1
- package/dist/chunk-B6ES7RHK.js +0 -11
- package/dist/chunk-B6ES7RHK.js.map +0 -1
- package/dist/chunk-HJ7LXEUC.mjs +0 -11
- package/dist/chunk-HJ7LXEUC.mjs.map +0 -1
- package/dist/chunk-JGRLDUOW.mjs +0 -89
- package/dist/chunk-JGRLDUOW.mjs.map +0 -1
- package/dist/chunk-JUURNM6C.js +0 -1
- package/dist/chunk-JUURNM6C.js.map +0 -1
- package/dist/chunk-OK6TSIOU.mjs +0 -1
- package/dist/chunk-OK6TSIOU.mjs.map +0 -1
- package/dist/chunk-OL334B2K.js +0 -20
- package/dist/chunk-OL334B2K.js.map +0 -1
- package/dist/chunk-PMCRFQY3.js +0 -1
- package/dist/chunk-PMCRFQY3.js.map +0 -1
- package/dist/chunk-PUAQGX73.js +0 -89
- package/dist/chunk-PUAQGX73.js.map +0 -1
- package/dist/chunk-QAVXIBA7.mjs +0 -20
- package/dist/chunk-QAVXIBA7.mjs.map +0 -1
- package/dist/chunk-RNQNNRF5.mjs +0 -1
- package/dist/chunk-RNQNNRF5.mjs.map +0 -1
- package/dist/chunk-UJIPPGP6.js +0 -19
- package/dist/chunk-UJIPPGP6.js.map +0 -1
- package/dist/chunk-ZNSHBDHA.mjs +0 -19
- package/dist/chunk-ZNSHBDHA.mjs.map +0 -1
- package/dist/index.js +0 -20
- package/dist/index.js.map +0 -1
- package/dist/logTypes/EthSignLog.js +0 -10
- package/dist/logTypes/EthSignLog.js.map +0 -1
- package/dist/logTypes/GenericLog.js +0 -2
- package/dist/logTypes/GenericLog.js.map +0 -1
- package/dist/logTypes/LogType.js +0 -8
- package/dist/logTypes/LogType.js.map +0 -1
- package/dist/logTypes/index.js +0 -16
- package/dist/logTypes/index.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/types/LoggingController.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/logTypes/EthSignLog.d.ts.map +0 -1
- package/dist/types/logTypes/GenericLog.d.ts +0 -6
- package/dist/types/logTypes/GenericLog.d.ts.map +0 -1
- package/dist/types/logTypes/LogType.d.ts.map +0 -1
- package/dist/types/logTypes/index.d.ts +0 -13
- package/dist/types/logTypes/index.d.ts.map +0 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
+
};
|
|
7
|
+
var _LoggingController_instances, _LoggingController_generateId;
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.LoggingController = void 0;
|
|
10
|
+
const base_controller_1 = require("@metamask/base-controller");
|
|
11
|
+
const uuid_1 = require("uuid");
|
|
12
|
+
const name = 'LoggingController';
|
|
13
|
+
const metadata = {
|
|
14
|
+
logs: { persist: true, anonymous: false },
|
|
15
|
+
};
|
|
16
|
+
const defaultState = {
|
|
17
|
+
logs: {},
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Controller that manages a list of logs for signature requests.
|
|
21
|
+
*/
|
|
22
|
+
class LoggingController extends base_controller_1.BaseController {
|
|
23
|
+
/**
|
|
24
|
+
* Creates a LoggingController instance.
|
|
25
|
+
*
|
|
26
|
+
* @param options - Constructor options
|
|
27
|
+
* @param options.messenger - An instance of the ControllerMessenger
|
|
28
|
+
* @param options.state - Initial state to set on this controller.
|
|
29
|
+
*/
|
|
30
|
+
constructor({ messenger, state, }) {
|
|
31
|
+
super({
|
|
32
|
+
name,
|
|
33
|
+
metadata,
|
|
34
|
+
messenger,
|
|
35
|
+
state: {
|
|
36
|
+
...defaultState,
|
|
37
|
+
...state,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
_LoggingController_instances.add(this);
|
|
41
|
+
this.messagingSystem.registerActionHandler(`${name}:add`, (log) => this.add(log));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Add log to the state.
|
|
45
|
+
*
|
|
46
|
+
* @param log - Log to add to the controller
|
|
47
|
+
*/
|
|
48
|
+
add(log) {
|
|
49
|
+
const newLog = {
|
|
50
|
+
id: __classPrivateFieldGet(this, _LoggingController_instances, "m", _LoggingController_generateId).call(this),
|
|
51
|
+
timestamp: Date.now(),
|
|
52
|
+
log,
|
|
53
|
+
};
|
|
54
|
+
this.update((state) => {
|
|
55
|
+
state.logs[newLog.id] = newLog;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Removes all log entries.
|
|
60
|
+
*/
|
|
61
|
+
clear() {
|
|
62
|
+
this.update((state) => {
|
|
63
|
+
state.logs = {};
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.LoggingController = LoggingController;
|
|
68
|
+
_LoggingController_instances = new WeakSet(), _LoggingController_generateId = function _LoggingController_generateId() {
|
|
69
|
+
let id = (0, uuid_1.v1)();
|
|
70
|
+
while (id in this.state.logs) {
|
|
71
|
+
id = (0, uuid_1.v1)();
|
|
72
|
+
}
|
|
73
|
+
return id;
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=LoggingController.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoggingController.cjs","sourceRoot":"","sources":["../src/LoggingController.ts"],"names":[],"mappings":";;;;;;;;;AAKA,+DAA2D;AAC3D,+BAAoC;AA0BpC,MAAM,IAAI,GAAG,mBAAmB,CAAC;AAgCjC,MAAM,QAAQ,GAAG;IACf,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE;CAC1C,CAAC;AAEF,MAAM,YAAY,GAAG;IACnB,IAAI,EAAE,EAAE;CACT,CAAC;AAEF;;GAEG;AACH,MAAa,iBAAkB,SAAQ,gCAItC;IACC;;;;;;OAMG;IACH,YAAY,EACV,SAAS,EACT,KAAK,GAIN;QACC,KAAK,CAAC;YACJ,IAAI;YACJ,QAAQ;YACR,SAAS;YACT,KAAK,EAAE;gBACL,GAAG,YAAY;gBACf,GAAG,KAAK;aACT;SACF,CAAC,CAAC;;QAEH,IAAI,CAAC,eAAe,CAAC,qBAAqB,CACxC,GAAG,IAAI,MAAe,EACtB,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAC5B,CAAC;IACJ,CAAC;IAmBD;;;;OAIG;IACH,GAAG,CAAC,GAAQ;QACV,MAAM,MAAM,GAAa;YACvB,EAAE,EAAE,uBAAA,IAAI,mEAAY,MAAhB,IAAI,CAAc;YACtB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,GAAG;SACJ,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA7ED,8CA6EC;;IAhCG,IAAI,EAAE,GAAG,IAAA,SAAM,GAAE,CAAC;IAClB,OAAO,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;QAC5B,EAAE,GAAG,IAAA,SAAM,GAAE,CAAC;KACf;IACD,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["import type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n RestrictedControllerMessenger,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport { v1 as random } from 'uuid';\n\nimport type { Log } from './logTypes';\n\n/**\n * LogEntry is the entry that will be added to the logging controller state.\n * It consists of a entry key that must be on of the Log union types, and an\n * additional id and timestamp.\n */\nexport type LogEntry = {\n id: string;\n timestamp: number;\n log: Log;\n};\n\n/**\n * Logging controller state\n *\n * @property logs - An object of logs indexed by their ids\n */\nexport type LoggingControllerState = {\n logs: {\n [id: string]: LogEntry;\n };\n};\n\nconst name = 'LoggingController';\n\n/**\n * An action to add log messages to the controller state.\n */\nexport type AddLog = {\n type: `${typeof name}:add`;\n handler: LoggingController['add'];\n};\n\nexport type LoggingControllerGetStateAction = ControllerGetStateAction<\n typeof name,\n LoggingControllerState\n>;\n\nexport type LoggingControllerActions = LoggingControllerGetStateAction | AddLog;\n\nexport type LoggingControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof name,\n LoggingControllerState\n>;\n\nexport type LoggingControllerEvents = LoggingControllerStateChangeEvent;\n\nexport type LoggingControllerMessenger = RestrictedControllerMessenger<\n typeof name,\n LoggingControllerActions,\n LoggingControllerEvents,\n never,\n never\n>;\n\nconst metadata = {\n logs: { persist: true, anonymous: false },\n};\n\nconst defaultState = {\n logs: {},\n};\n\n/**\n * Controller that manages a list of logs for signature requests.\n */\nexport class LoggingController extends BaseController<\n typeof name,\n LoggingControllerState,\n LoggingControllerMessenger\n> {\n /**\n * Creates a LoggingController instance.\n *\n * @param options - Constructor options\n * @param options.messenger - An instance of the ControllerMessenger\n * @param options.state - Initial state to set on this controller.\n */\n constructor({\n messenger,\n state,\n }: {\n messenger: LoggingControllerMessenger;\n state?: Partial<LoggingControllerState>;\n }) {\n super({\n name,\n metadata,\n messenger,\n state: {\n ...defaultState,\n ...state,\n },\n });\n\n this.messagingSystem.registerActionHandler(\n `${name}:add` as const,\n (log: Log) => this.add(log),\n );\n }\n\n /**\n * Method to generate a randomId and ensures no collision with existing ids.\n *\n * We may want to end up using a hashing mechanism to make ids deterministic\n * by the *data* passed in, and then make each key an array of logs that\n * match that id.\n *\n * @returns unique id\n */\n #generateId(): string {\n let id = random();\n while (id in this.state.logs) {\n id = random();\n }\n return id;\n }\n\n /**\n * Add log to the state.\n *\n * @param log - Log to add to the controller\n */\n add(log: Log) {\n const newLog: LogEntry = {\n id: this.#generateId(),\n timestamp: Date.now(),\n log,\n };\n\n this.update((state) => {\n state.logs[newLog.id] = newLog;\n });\n }\n\n /**\n * Removes all log entries.\n */\n clear() {\n this.update((state) => {\n state.logs = {};\n });\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ControllerGetStateAction, ControllerStateChangeEvent, RestrictedControllerMessenger } from
|
|
2
|
-
import { BaseController } from
|
|
3
|
-
import type { Log } from
|
|
1
|
+
import type { ControllerGetStateAction, ControllerStateChangeEvent, RestrictedControllerMessenger } from "@metamask/base-controller";
|
|
2
|
+
import { BaseController } from "@metamask/base-controller";
|
|
3
|
+
import type { Log } from "./logTypes/index.cjs";
|
|
4
4
|
/**
|
|
5
5
|
* LogEntry is the entry that will be added to the logging controller state.
|
|
6
6
|
* It consists of a entry key that must be on of the Log union types, and an
|
|
@@ -62,4 +62,4 @@ export declare class LoggingController extends BaseController<typeof name, Loggi
|
|
|
62
62
|
clear(): void;
|
|
63
63
|
}
|
|
64
64
|
export {};
|
|
65
|
-
//# sourceMappingURL=LoggingController.d.
|
|
65
|
+
//# sourceMappingURL=LoggingController.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoggingController.d.cts","sourceRoot":"","sources":["../src/LoggingController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,6BAA6B,EAC9B,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAG3D,OAAO,KAAK,EAAE,GAAG,EAAE,6BAAmB;AAEtC;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE;QACJ,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,CAAC;KACxB,CAAC;CACH,CAAC;AAEF,QAAA,MAAM,IAAI,sBAAsB,CAAC;AAEjC;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,GAAG,OAAO,IAAI,MAAM,CAAC;IAC3B,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,wBAAwB,CACpE,OAAO,IAAI,EACX,sBAAsB,CACvB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,+BAA+B,GAAG,MAAM,CAAC;AAEhF,MAAM,MAAM,iCAAiC,GAAG,0BAA0B,CACxE,OAAO,IAAI,EACX,sBAAsB,CACvB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,iCAAiC,CAAC;AAExE,MAAM,MAAM,0BAA0B,GAAG,6BAA6B,CACpE,OAAO,IAAI,EACX,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,EACL,KAAK,CACN,CAAC;AAUF;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc,CACnD,OAAO,IAAI,EACX,sBAAsB,EACtB,0BAA0B,CAC3B;;IACC;;;;;;OAMG;gBACS,EACV,SAAS,EACT,KAAK,GACN,EAAE;QACD,SAAS,EAAE,0BAA0B,CAAC;QACtC,KAAK,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;KACzC;IAkCD;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,GAAG;IAYZ;;OAEG;IACH,KAAK;CAKN"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ControllerGetStateAction, ControllerStateChangeEvent, RestrictedControllerMessenger } from "@metamask/base-controller";
|
|
2
|
+
import { BaseController } from "@metamask/base-controller";
|
|
3
|
+
import type { Log } from "./logTypes/index.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* LogEntry is the entry that will be added to the logging controller state.
|
|
6
|
+
* It consists of a entry key that must be on of the Log union types, and an
|
|
7
|
+
* additional id and timestamp.
|
|
8
|
+
*/
|
|
9
|
+
export type LogEntry = {
|
|
10
|
+
id: string;
|
|
11
|
+
timestamp: number;
|
|
12
|
+
log: Log;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Logging controller state
|
|
16
|
+
*
|
|
17
|
+
* @property logs - An object of logs indexed by their ids
|
|
18
|
+
*/
|
|
19
|
+
export type LoggingControllerState = {
|
|
20
|
+
logs: {
|
|
21
|
+
[id: string]: LogEntry;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
declare const name = "LoggingController";
|
|
25
|
+
/**
|
|
26
|
+
* An action to add log messages to the controller state.
|
|
27
|
+
*/
|
|
28
|
+
export type AddLog = {
|
|
29
|
+
type: `${typeof name}:add`;
|
|
30
|
+
handler: LoggingController['add'];
|
|
31
|
+
};
|
|
32
|
+
export type LoggingControllerGetStateAction = ControllerGetStateAction<typeof name, LoggingControllerState>;
|
|
33
|
+
export type LoggingControllerActions = LoggingControllerGetStateAction | AddLog;
|
|
34
|
+
export type LoggingControllerStateChangeEvent = ControllerStateChangeEvent<typeof name, LoggingControllerState>;
|
|
35
|
+
export type LoggingControllerEvents = LoggingControllerStateChangeEvent;
|
|
36
|
+
export type LoggingControllerMessenger = RestrictedControllerMessenger<typeof name, LoggingControllerActions, LoggingControllerEvents, never, never>;
|
|
37
|
+
/**
|
|
38
|
+
* Controller that manages a list of logs for signature requests.
|
|
39
|
+
*/
|
|
40
|
+
export declare class LoggingController extends BaseController<typeof name, LoggingControllerState, LoggingControllerMessenger> {
|
|
41
|
+
#private;
|
|
42
|
+
/**
|
|
43
|
+
* Creates a LoggingController instance.
|
|
44
|
+
*
|
|
45
|
+
* @param options - Constructor options
|
|
46
|
+
* @param options.messenger - An instance of the ControllerMessenger
|
|
47
|
+
* @param options.state - Initial state to set on this controller.
|
|
48
|
+
*/
|
|
49
|
+
constructor({ messenger, state, }: {
|
|
50
|
+
messenger: LoggingControllerMessenger;
|
|
51
|
+
state?: Partial<LoggingControllerState>;
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* Add log to the state.
|
|
55
|
+
*
|
|
56
|
+
* @param log - Log to add to the controller
|
|
57
|
+
*/
|
|
58
|
+
add(log: Log): void;
|
|
59
|
+
/**
|
|
60
|
+
* Removes all log entries.
|
|
61
|
+
*/
|
|
62
|
+
clear(): void;
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=LoggingController.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoggingController.d.mts","sourceRoot":"","sources":["../src/LoggingController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,6BAA6B,EAC9B,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAG3D,OAAO,KAAK,EAAE,GAAG,EAAE,6BAAmB;AAEtC;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE;QACJ,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,CAAC;KACxB,CAAC;CACH,CAAC;AAEF,QAAA,MAAM,IAAI,sBAAsB,CAAC;AAEjC;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,GAAG,OAAO,IAAI,MAAM,CAAC;IAC3B,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,wBAAwB,CACpE,OAAO,IAAI,EACX,sBAAsB,CACvB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,+BAA+B,GAAG,MAAM,CAAC;AAEhF,MAAM,MAAM,iCAAiC,GAAG,0BAA0B,CACxE,OAAO,IAAI,EACX,sBAAsB,CACvB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,iCAAiC,CAAC;AAExE,MAAM,MAAM,0BAA0B,GAAG,6BAA6B,CACpE,OAAO,IAAI,EACX,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,EACL,KAAK,CACN,CAAC;AAUF;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc,CACnD,OAAO,IAAI,EACX,sBAAsB,EACtB,0BAA0B,CAC3B;;IACC;;;;;;OAMG;gBACS,EACV,SAAS,EACT,KAAK,GACN,EAAE;QACD,SAAS,EAAE,0BAA0B,CAAC;QACtC,KAAK,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;KACzC;IAkCD;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,GAAG;IAYZ;;OAEG;IACH,KAAK;CAKN"}
|
|
@@ -1,8 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _LoggingController_instances, _LoggingController_generateId;
|
|
7
|
+
import { BaseController } from "@metamask/base-controller";
|
|
8
|
+
import { v1 as random } from "uuid";
|
|
9
|
+
const name = 'LoggingController';
|
|
10
|
+
const metadata = {
|
|
11
|
+
logs: { persist: true, anonymous: false },
|
|
12
|
+
};
|
|
13
|
+
const defaultState = {
|
|
14
|
+
logs: {},
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Controller that manages a list of logs for signature requests.
|
|
18
|
+
*/
|
|
19
|
+
export class LoggingController extends BaseController {
|
|
20
|
+
/**
|
|
21
|
+
* Creates a LoggingController instance.
|
|
22
|
+
*
|
|
23
|
+
* @param options - Constructor options
|
|
24
|
+
* @param options.messenger - An instance of the ControllerMessenger
|
|
25
|
+
* @param options.state - Initial state to set on this controller.
|
|
26
|
+
*/
|
|
27
|
+
constructor({ messenger, state, }) {
|
|
28
|
+
super({
|
|
29
|
+
name,
|
|
30
|
+
metadata,
|
|
31
|
+
messenger,
|
|
32
|
+
state: {
|
|
33
|
+
...defaultState,
|
|
34
|
+
...state,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
_LoggingController_instances.add(this);
|
|
38
|
+
this.messagingSystem.registerActionHandler(`${name}:add`, (log) => this.add(log));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Add log to the state.
|
|
42
|
+
*
|
|
43
|
+
* @param log - Log to add to the controller
|
|
44
|
+
*/
|
|
45
|
+
add(log) {
|
|
46
|
+
const newLog = {
|
|
47
|
+
id: __classPrivateFieldGet(this, _LoggingController_instances, "m", _LoggingController_generateId).call(this),
|
|
48
|
+
timestamp: Date.now(),
|
|
49
|
+
log,
|
|
50
|
+
};
|
|
51
|
+
this.update((state) => {
|
|
52
|
+
state.logs[newLog.id] = newLog;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Removes all log entries.
|
|
57
|
+
*/
|
|
58
|
+
clear() {
|
|
59
|
+
this.update((state) => {
|
|
60
|
+
state.logs = {};
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
_LoggingController_instances = new WeakSet(), _LoggingController_generateId = function _LoggingController_generateId() {
|
|
65
|
+
let id = random();
|
|
66
|
+
while (id in this.state.logs) {
|
|
67
|
+
id = random();
|
|
68
|
+
}
|
|
69
|
+
return id;
|
|
7
70
|
};
|
|
8
71
|
//# sourceMappingURL=LoggingController.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"LoggingController.mjs","sourceRoot":"","sources":["../src/LoggingController.ts"],"names":[],"mappings":";;;;;;AAKA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,aAAa;AA0BpC,MAAM,IAAI,GAAG,mBAAmB,CAAC;AAgCjC,MAAM,QAAQ,GAAG;IACf,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE;CAC1C,CAAC;AAEF,MAAM,YAAY,GAAG;IACnB,IAAI,EAAE,EAAE;CACT,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,cAItC;IACC;;;;;;OAMG;IACH,YAAY,EACV,SAAS,EACT,KAAK,GAIN;QACC,KAAK,CAAC;YACJ,IAAI;YACJ,QAAQ;YACR,SAAS;YACT,KAAK,EAAE;gBACL,GAAG,YAAY;gBACf,GAAG,KAAK;aACT;SACF,CAAC,CAAC;;QAEH,IAAI,CAAC,eAAe,CAAC,qBAAqB,CACxC,GAAG,IAAI,MAAe,EACtB,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAC5B,CAAC;IACJ,CAAC;IAmBD;;;;OAIG;IACH,GAAG,CAAC,GAAQ;QACV,MAAM,MAAM,GAAa;YACvB,EAAE,EAAE,uBAAA,IAAI,mEAAY,MAAhB,IAAI,CAAc;YACtB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,GAAG;SACJ,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;YACpB,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;;IAhCG,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;QAC5B,EAAE,GAAG,MAAM,EAAE,CAAC;KACf;IACD,OAAO,EAAE,CAAC;AACZ,CAAC","sourcesContent":["import type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n RestrictedControllerMessenger,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport { v1 as random } from 'uuid';\n\nimport type { Log } from './logTypes';\n\n/**\n * LogEntry is the entry that will be added to the logging controller state.\n * It consists of a entry key that must be on of the Log union types, and an\n * additional id and timestamp.\n */\nexport type LogEntry = {\n id: string;\n timestamp: number;\n log: Log;\n};\n\n/**\n * Logging controller state\n *\n * @property logs - An object of logs indexed by their ids\n */\nexport type LoggingControllerState = {\n logs: {\n [id: string]: LogEntry;\n };\n};\n\nconst name = 'LoggingController';\n\n/**\n * An action to add log messages to the controller state.\n */\nexport type AddLog = {\n type: `${typeof name}:add`;\n handler: LoggingController['add'];\n};\n\nexport type LoggingControllerGetStateAction = ControllerGetStateAction<\n typeof name,\n LoggingControllerState\n>;\n\nexport type LoggingControllerActions = LoggingControllerGetStateAction | AddLog;\n\nexport type LoggingControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof name,\n LoggingControllerState\n>;\n\nexport type LoggingControllerEvents = LoggingControllerStateChangeEvent;\n\nexport type LoggingControllerMessenger = RestrictedControllerMessenger<\n typeof name,\n LoggingControllerActions,\n LoggingControllerEvents,\n never,\n never\n>;\n\nconst metadata = {\n logs: { persist: true, anonymous: false },\n};\n\nconst defaultState = {\n logs: {},\n};\n\n/**\n * Controller that manages a list of logs for signature requests.\n */\nexport class LoggingController extends BaseController<\n typeof name,\n LoggingControllerState,\n LoggingControllerMessenger\n> {\n /**\n * Creates a LoggingController instance.\n *\n * @param options - Constructor options\n * @param options.messenger - An instance of the ControllerMessenger\n * @param options.state - Initial state to set on this controller.\n */\n constructor({\n messenger,\n state,\n }: {\n messenger: LoggingControllerMessenger;\n state?: Partial<LoggingControllerState>;\n }) {\n super({\n name,\n metadata,\n messenger,\n state: {\n ...defaultState,\n ...state,\n },\n });\n\n this.messagingSystem.registerActionHandler(\n `${name}:add` as const,\n (log: Log) => this.add(log),\n );\n }\n\n /**\n * Method to generate a randomId and ensures no collision with existing ids.\n *\n * We may want to end up using a hashing mechanism to make ids deterministic\n * by the *data* passed in, and then make each key an array of logs that\n * match that id.\n *\n * @returns unique id\n */\n #generateId(): string {\n let id = random();\n while (id in this.state.logs) {\n id = random();\n }\n return id;\n }\n\n /**\n * Add log to the state.\n *\n * @param log - Log to add to the controller\n */\n add(log: Log) {\n const newLog: LogEntry = {\n id: this.#generateId(),\n timestamp: Date.now(),\n log,\n };\n\n this.update((state) => {\n state.logs[newLog.id] = newLog;\n });\n }\n\n /**\n * Removes all log entries.\n */\n clear() {\n this.update((state) => {\n state.logs = {};\n });\n }\n}\n"]}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./LoggingController.cjs"), exports);
|
|
18
|
+
__exportStar(require("./logTypes/index.cjs"), exports);
|
|
19
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAoC;AACpC,uDAA2B","sourcesContent":["export * from './LoggingController';\nexport * from './logTypes';\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAoC;AACpC,qCAA2B"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAoC;AACpC,qCAA2B"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
} from "./chunk-JGRLDUOW.mjs";
|
|
4
|
-
import "./chunk-RNQNNRF5.mjs";
|
|
5
|
-
import {
|
|
6
|
-
SigningMethod,
|
|
7
|
-
SigningStage
|
|
8
|
-
} from "./chunk-QAVXIBA7.mjs";
|
|
9
|
-
import "./chunk-OK6TSIOU.mjs";
|
|
10
|
-
import {
|
|
11
|
-
LogType
|
|
12
|
-
} from "./chunk-HJ7LXEUC.mjs";
|
|
13
|
-
import "./chunk-ZNSHBDHA.mjs";
|
|
14
|
-
export {
|
|
15
|
-
LogType,
|
|
16
|
-
LoggingController,
|
|
17
|
-
SigningMethod,
|
|
18
|
-
SigningStage
|
|
19
|
-
};
|
|
1
|
+
export * from "./LoggingController.mjs";
|
|
2
|
+
export * from "./logTypes/index.mjs";
|
|
20
3
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wCAAoC;AACpC,qCAA2B","sourcesContent":["export * from './LoggingController';\nexport * from './logTypes';\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SigningStage = exports.SigningMethod = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* An enum of the signing method types that we are interested in logging.
|
|
6
|
+
*/
|
|
7
|
+
var SigningMethod;
|
|
8
|
+
(function (SigningMethod) {
|
|
9
|
+
SigningMethod["PersonalSign"] = "personal_sign";
|
|
10
|
+
SigningMethod["EthSignTypedData"] = "eth_signTypedData";
|
|
11
|
+
SigningMethod["EthSignTypedDataV3"] = "eth_signTypedData_v3";
|
|
12
|
+
SigningMethod["EthSignTypedDataV4"] = "eth_signTypedData_v4";
|
|
13
|
+
})(SigningMethod || (exports.SigningMethod = SigningMethod = {}));
|
|
14
|
+
/**
|
|
15
|
+
* An enum of the various stages of the signing request
|
|
16
|
+
*/
|
|
17
|
+
var SigningStage;
|
|
18
|
+
(function (SigningStage) {
|
|
19
|
+
SigningStage["Proposed"] = "proposed";
|
|
20
|
+
SigningStage["Rejected"] = "rejected";
|
|
21
|
+
SigningStage["Signed"] = "signed";
|
|
22
|
+
})(SigningStage || (exports.SigningStage = SigningStage = {}));
|
|
23
|
+
//# sourceMappingURL=EthSignLog.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthSignLog.cjs","sourceRoot":"","sources":["../../src/logTypes/EthSignLog.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,+CAA8B,CAAA;IAC9B,uDAAsC,CAAA;IACtC,4DAA2C,CAAA;IAC3C,4DAA2C,CAAA;AAC7C,CAAC,EALW,aAAa,6BAAb,aAAa,QAKxB;AAED;;GAEG;AACH,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,qCAAqB,CAAA;IACrB,qCAAqB,CAAA;IACrB,iCAAiB,CAAA;AACnB,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB","sourcesContent":["import type { LogType } from './LogType';\n\n/**\n * An enum of the signing method types that we are interested in logging.\n */\nexport enum SigningMethod {\n PersonalSign = 'personal_sign',\n EthSignTypedData = 'eth_signTypedData',\n EthSignTypedDataV3 = 'eth_signTypedData_v3',\n EthSignTypedDataV4 = 'eth_signTypedData_v4',\n}\n\n/**\n * An enum of the various stages of the signing request\n */\nexport enum SigningStage {\n Proposed = 'proposed',\n Rejected = 'rejected',\n Signed = 'signed',\n}\n\n/**\n * First special case of logging scenarios involves signing requests. In this\n * case the data provided must include the method for the signature request as\n * well as the signingData. This is intended to be used to troubleshoot and\n * investigate FLI at the user's request.\n */\nexport type EthSignLog = {\n type: LogType.EthSignLog;\n data: {\n signingMethod: SigningMethod;\n stage: SigningStage;\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n signingData?: any;\n };\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LogType } from
|
|
1
|
+
import type { LogType } from "./LogType.cjs";
|
|
2
2
|
/**
|
|
3
3
|
* An enum of the signing method types that we are interested in logging.
|
|
4
4
|
*/
|
|
@@ -30,4 +30,4 @@ export type EthSignLog = {
|
|
|
30
30
|
signingData?: any;
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
-
//# sourceMappingURL=EthSignLog.d.
|
|
33
|
+
//# sourceMappingURL=EthSignLog.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthSignLog.d.cts","sourceRoot":"","sources":["../../src/logTypes/EthSignLog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AAEzC;;GAEG;AACH,oBAAY,aAAa;IACvB,YAAY,kBAAkB;IAC9B,gBAAgB,sBAAsB;IACtC,kBAAkB,yBAAyB;IAC3C,kBAAkB,yBAAyB;CAC5C;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC;IACzB,IAAI,EAAE;QACJ,aAAa,EAAE,aAAa,CAAC;QAC7B,KAAK,EAAE,YAAY,CAAC;QAGpB,WAAW,CAAC,EAAE,GAAG,CAAC;KACnB,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { LogType } from "./LogType.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* An enum of the signing method types that we are interested in logging.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum SigningMethod {
|
|
6
|
+
PersonalSign = "personal_sign",
|
|
7
|
+
EthSignTypedData = "eth_signTypedData",
|
|
8
|
+
EthSignTypedDataV3 = "eth_signTypedData_v3",
|
|
9
|
+
EthSignTypedDataV4 = "eth_signTypedData_v4"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* An enum of the various stages of the signing request
|
|
13
|
+
*/
|
|
14
|
+
export declare enum SigningStage {
|
|
15
|
+
Proposed = "proposed",
|
|
16
|
+
Rejected = "rejected",
|
|
17
|
+
Signed = "signed"
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* First special case of logging scenarios involves signing requests. In this
|
|
21
|
+
* case the data provided must include the method for the signature request as
|
|
22
|
+
* well as the signingData. This is intended to be used to troubleshoot and
|
|
23
|
+
* investigate FLI at the user's request.
|
|
24
|
+
*/
|
|
25
|
+
export type EthSignLog = {
|
|
26
|
+
type: LogType.EthSignLog;
|
|
27
|
+
data: {
|
|
28
|
+
signingMethod: SigningMethod;
|
|
29
|
+
stage: SigningStage;
|
|
30
|
+
signingData?: any;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=EthSignLog.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthSignLog.d.mts","sourceRoot":"","sources":["../../src/logTypes/EthSignLog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AAEzC;;GAEG;AACH,oBAAY,aAAa;IACvB,YAAY,kBAAkB;IAC9B,gBAAgB,sBAAsB;IACtC,kBAAkB,yBAAyB;IAC3C,kBAAkB,yBAAyB;CAC5C;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC;IACzB,IAAI,EAAE;QACJ,aAAa,EAAE,aAAa,CAAC;QAC7B,KAAK,EAAE,YAAY,CAAC;QAGpB,WAAW,CAAC,EAAE,GAAG,CAAC;KACnB,CAAC;CACH,CAAC"}
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
/**
|
|
2
|
+
* An enum of the signing method types that we are interested in logging.
|
|
3
|
+
*/
|
|
4
|
+
export var SigningMethod;
|
|
5
|
+
(function (SigningMethod) {
|
|
6
|
+
SigningMethod["PersonalSign"] = "personal_sign";
|
|
7
|
+
SigningMethod["EthSignTypedData"] = "eth_signTypedData";
|
|
8
|
+
SigningMethod["EthSignTypedDataV3"] = "eth_signTypedData_v3";
|
|
9
|
+
SigningMethod["EthSignTypedDataV4"] = "eth_signTypedData_v4";
|
|
10
|
+
})(SigningMethod || (SigningMethod = {}));
|
|
11
|
+
/**
|
|
12
|
+
* An enum of the various stages of the signing request
|
|
13
|
+
*/
|
|
14
|
+
export var SigningStage;
|
|
15
|
+
(function (SigningStage) {
|
|
16
|
+
SigningStage["Proposed"] = "proposed";
|
|
17
|
+
SigningStage["Rejected"] = "rejected";
|
|
18
|
+
SigningStage["Signed"] = "signed";
|
|
19
|
+
})(SigningStage || (SigningStage = {}));
|
|
10
20
|
//# sourceMappingURL=EthSignLog.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"EthSignLog.mjs","sourceRoot":"","sources":["../../src/logTypes/EthSignLog.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAN,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,+CAA8B,CAAA;IAC9B,uDAAsC,CAAA;IACtC,4DAA2C,CAAA;IAC3C,4DAA2C,CAAA;AAC7C,CAAC,EALW,aAAa,KAAb,aAAa,QAKxB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,qCAAqB,CAAA;IACrB,qCAAqB,CAAA;IACrB,iCAAiB,CAAA;AACnB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB","sourcesContent":["import type { LogType } from './LogType';\n\n/**\n * An enum of the signing method types that we are interested in logging.\n */\nexport enum SigningMethod {\n PersonalSign = 'personal_sign',\n EthSignTypedData = 'eth_signTypedData',\n EthSignTypedDataV3 = 'eth_signTypedData_v3',\n EthSignTypedDataV4 = 'eth_signTypedData_v4',\n}\n\n/**\n * An enum of the various stages of the signing request\n */\nexport enum SigningStage {\n Proposed = 'proposed',\n Rejected = 'rejected',\n Signed = 'signed',\n}\n\n/**\n * First special case of logging scenarios involves signing requests. In this\n * case the data provided must include the method for the signature request as\n * well as the signingData. This is intended to be used to troubleshoot and\n * investigate FLI at the user's request.\n */\nexport type EthSignLog = {\n type: LogType.EthSignLog;\n data: {\n signingMethod: SigningMethod;\n stage: SigningStage;\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n signingData?: any;\n };\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericLog.cjs","sourceRoot":"","sources":["../../src/logTypes/GenericLog.ts"],"names":[],"mappings":"","sourcesContent":["import type { LogType } from './LogType';\n\n/*\n * The logging controller can handle any kind of log statement that may benefit\n * users and MetaMask support agents helping those users. These logs are typed\n * as generic.\n */\nexport type GenericLog = {\n type: LogType.GenericLog;\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericLog.d.cts","sourceRoot":"","sources":["../../src/logTypes/GenericLog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AAOzC,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC;IAGzB,IAAI,EAAE,GAAG,CAAC;CACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericLog.d.mts","sourceRoot":"","sources":["../../src/logTypes/GenericLog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAkB;AAOzC,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC;IAGzB,IAAI,EAAE,GAAG,CAAC;CACX,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=GenericLog.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"GenericLog.mjs","sourceRoot":"","sources":["../../src/logTypes/GenericLog.ts"],"names":[],"mappings":"","sourcesContent":["import type { LogType } from './LogType';\n\n/*\n * The logging controller can handle any kind of log statement that may benefit\n * users and MetaMask support agents helping those users. These logs are typed\n * as generic.\n */\nexport type GenericLog = {\n type: LogType.GenericLog;\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: any;\n};\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogType = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* An enum representing the allowed types of log messages supported by this
|
|
6
|
+
* controller. When adding new types of special cased log types, make sure to
|
|
7
|
+
* extend this enum with the new type name.
|
|
8
|
+
*/
|
|
9
|
+
var LogType;
|
|
10
|
+
(function (LogType) {
|
|
11
|
+
LogType["GenericLog"] = "GenericLog";
|
|
12
|
+
LogType["EthSignLog"] = "EthSignLog";
|
|
13
|
+
})(LogType || (exports.LogType = LogType = {}));
|
|
14
|
+
//# sourceMappingURL=LogType.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogType.cjs","sourceRoot":"","sources":["../../src/logTypes/LogType.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,oCAAyB,CAAA;IACzB,oCAAyB,CAAA;AAC3B,CAAC,EAHW,OAAO,uBAAP,OAAO,QAGlB","sourcesContent":["/**\n * An enum representing the allowed types of log messages supported by this\n * controller. When adding new types of special cased log types, make sure to\n * extend this enum with the new type name.\n */\nexport enum LogType {\n GenericLog = 'GenericLog',\n EthSignLog = 'EthSignLog',\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogType.d.cts","sourceRoot":"","sources":["../../src/logTypes/LogType.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,OAAO;IACjB,UAAU,eAAe;IACzB,UAAU,eAAe;CAC1B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An enum representing the allowed types of log messages supported by this
|
|
3
|
+
* controller. When adding new types of special cased log types, make sure to
|
|
4
|
+
* extend this enum with the new type name.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum LogType {
|
|
7
|
+
GenericLog = "GenericLog",
|
|
8
|
+
EthSignLog = "EthSignLog"
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=LogType.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogType.d.mts","sourceRoot":"","sources":["../../src/logTypes/LogType.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,OAAO;IACjB,UAAU,eAAe;IACzB,UAAU,eAAe;CAC1B"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/**
|
|
2
|
+
* An enum representing the allowed types of log messages supported by this
|
|
3
|
+
* controller. When adding new types of special cased log types, make sure to
|
|
4
|
+
* extend this enum with the new type name.
|
|
5
|
+
*/
|
|
6
|
+
export var LogType;
|
|
7
|
+
(function (LogType) {
|
|
8
|
+
LogType["GenericLog"] = "GenericLog";
|
|
9
|
+
LogType["EthSignLog"] = "EthSignLog";
|
|
10
|
+
})(LogType || (LogType = {}));
|
|
8
11
|
//# sourceMappingURL=LogType.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"LogType.mjs","sourceRoot":"","sources":["../../src/logTypes/LogType.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAN,IAAY,OAGX;AAHD,WAAY,OAAO;IACjB,oCAAyB,CAAA;IACzB,oCAAyB,CAAA;AAC3B,CAAC,EAHW,OAAO,KAAP,OAAO,QAGlB","sourcesContent":["/**\n * An enum representing the allowed types of log messages supported by this\n * controller. When adding new types of special cased log types, make sure to\n * extend this enum with the new type name.\n */\nexport enum LogType {\n GenericLog = 'GenericLog',\n EthSignLog = 'EthSignLog',\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/**
|
|
18
|
+
* Export all other types from these files for usage by clients
|
|
19
|
+
*/
|
|
20
|
+
__exportStar(require("./EthSignLog.cjs"), exports);
|
|
21
|
+
__exportStar(require("./GenericLog.cjs"), exports);
|
|
22
|
+
__exportStar(require("./LogType.cjs"), exports);
|
|
23
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/logTypes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAQA;;GAEG;AACH,mDAA6B;AAC7B,mDAA6B;AAC7B,gDAA0B","sourcesContent":["import type { EthSignLog } from './EthSignLog';\nimport type { GenericLog } from './GenericLog';\n\n/**\n * Union of all possible log data structures.\n */\nexport type Log = EthSignLog | GenericLog;\n\n/**\n * Export all other types from these files for usage by clients\n */\nexport * from './EthSignLog';\nexport * from './GenericLog';\nexport * from './LogType';\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EthSignLog } from "./EthSignLog.cjs";
|
|
2
|
+
import type { GenericLog } from "./GenericLog.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* Union of all possible log data structures.
|
|
5
|
+
*/
|
|
6
|
+
export type Log = EthSignLog | GenericLog;
|
|
7
|
+
/**
|
|
8
|
+
* Export all other types from these files for usage by clients
|
|
9
|
+
*/
|
|
10
|
+
export * from "./EthSignLog.cjs";
|
|
11
|
+
export * from "./GenericLog.cjs";
|
|
12
|
+
export * from "./LogType.cjs";
|
|
13
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/logTypes/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAqB;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAqB;AAE/C;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,UAAU,GAAG,UAAU,CAAC;AAE1C;;GAEG;AACH,iCAA6B;AAC7B,iCAA6B;AAC7B,8BAA0B"}
|