@metamask-previews/account-tree-controller 0.7.0-preview-af4e47c0 → 0.7.0-preview-5e0fb2b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -9
- package/dist/AccountTreeController.cjs +36 -183
- package/dist/AccountTreeController.cjs.map +1 -1
- package/dist/AccountTreeController.d.cts +0 -32
- package/dist/AccountTreeController.d.cts.map +1 -1
- package/dist/AccountTreeController.d.mts +0 -32
- package/dist/AccountTreeController.d.mts.map +1 -1
- package/dist/AccountTreeController.mjs +36 -183
- package/dist/AccountTreeController.mjs.map +1 -1
- package/dist/group.cjs.map +1 -1
- package/dist/group.d.cts +8 -19
- package/dist/group.d.cts.map +1 -1
- package/dist/group.d.mts +8 -19
- package/dist/group.d.mts.map +1 -1
- package/dist/group.mjs.map +1 -1
- package/dist/rules/entropy.cjs +0 -2
- package/dist/rules/entropy.cjs.map +1 -1
- package/dist/rules/entropy.d.cts.map +1 -1
- package/dist/rules/entropy.d.mts.map +1 -1
- package/dist/rules/entropy.mjs +0 -2
- package/dist/rules/entropy.mjs.map +1 -1
- package/dist/rules/keyring.cjs +1 -4
- package/dist/rules/keyring.cjs.map +1 -1
- package/dist/rules/keyring.d.cts.map +1 -1
- package/dist/rules/keyring.d.mts.map +1 -1
- package/dist/rules/keyring.mjs +1 -4
- package/dist/rules/keyring.mjs.map +1 -1
- package/dist/rules/snap.cjs +1 -4
- package/dist/rules/snap.cjs.map +1 -1
- package/dist/rules/snap.d.cts.map +1 -1
- package/dist/rules/snap.d.mts.map +1 -1
- package/dist/rules/snap.mjs +1 -4
- package/dist/rules/snap.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +1 -14
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +1 -14
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/wallet.cjs.map +1 -1
- package/dist/wallet.d.cts +9 -16
- package/dist/wallet.d.cts.map +1 -1
- package/dist/wallet.d.mts +9 -16
- package/dist/wallet.d.mts.map +1 -1
- package/dist/wallet.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/type-utils.cjs +0 -3
- package/dist/type-utils.cjs.map +0 -1
- package/dist/type-utils.d.cts +0 -24
- package/dist/type-utils.d.cts.map +0 -1
- package/dist/type-utils.d.mts +0 -24
- package/dist/type-utils.d.mts.map +0 -1
- package/dist/type-utils.mjs +0 -2
- package/dist/type-utils.mjs.map +0 -1
package/dist/wallet.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.mts","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,yBAAyB,EAC1B,8BAA8B;AAC/B,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,8BAA8B;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,8BAA8B;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,qCAAqC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,4BAA4B;AAElD,OAAO,KAAK,EACV,mCAAmC,EACnC,kBAAkB,EAClB,+BAA+B,EAChC,oBAAgB;AACjB,OAAO,EAAE,gBAAgB,EAAE,oBAAgB;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"wallet.d.mts","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,yBAAyB,EAC1B,8BAA8B;AAC/B,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,8BAA8B;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,8BAA8B;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,qCAAqC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,uC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O,EAAE,cAAc,GAAG,gBAAgB,GAAG,SAAS;IAItE;;;;;;OAMG;IACH,sBAAsB,CAAC,OAAO,EAAE,cAAc,GAAG,gBAAgB;IASjE;;;;OAIG;IACH,gBAAgB,IAAI,gBAAgB,EAAE;CAGvC"}
|
package/dist/wallet.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.mjs","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,OAAO,EAAE,gBAAgB,EAAE,oBAAgB;
|
|
1
|
+
{"version":3,"file":"wallet.mjs","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,OAAO,EAAE,gBAAgB,EAAE,oBAAgB;AA8F3C;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAO5B,YAAY,EACV,SAAS,EACT,MAAM,GAIP;QAZQ,4CAA6B;QAapC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,uBAAA,IAAI,6BAAW,MAAM,MAAA,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;QAExB,KAAK,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,uBAAA,IAAI,iCAAQ,CAAC,MAAM,CAAC,EAAE;YAClE,IAAI,CAAC,MAAM,CAAC,GAAG,CACb,OAAyB,EACzB,IAAI,gBAAgB,CAAC;gBACnB,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,MAAM,EAAE,IAAI;gBACZ,KAAK;aACN,CAAC,CACH,CAAC;SACH;IACH,CAAC;IAED,IAAI,EAAE;QACJ,OAAO,uBAAA,IAAI,iCAAQ,CAAC,EAAE,CAAC;IACzB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,uBAAA,IAAI,iCAAQ,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,IAAI,IAAI;QACN,OAAO,uBAAA,IAAI,iCAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC;IACpC,CAAC;IAED;;;;;OAKG;IACH,eAAe,CAAC,OAAuB;QACrC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;OAMG;IACH,sBAAsB,CAAC,OAAuB;QAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;SAChD;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;OAIG;IACH,gBAAgB;QACd,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import type {\n AccountWalletType,\n AccountWalletId,\n MultichainAccountWalletId,\n} from '@metamask/account-api';\nimport { type AccountGroupId, type AccountWallet } from '@metamask/account-api';\nimport type { EntropySourceId } from '@metamask/keyring-api';\nimport type { KeyringTypes } from '@metamask/keyring-controller';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport type { SnapId } from '@metamask/snaps-sdk';\n\nimport type {\n AccountGroupMultichainAccountObject,\n AccountGroupObject,\n AccountGroupSingleAccountObject,\n} from './group';\nimport { AccountTreeGroup } from './group';\nimport { type AccountTreeControllerMessenger } from './types';\n\n/**\n * Type constraint for a {@link AccountGroupObject}. If one of its union-members\n * does not match this contraint, {@link AccountGroupObject} will resolve\n * to `never`.\n */\ntype IsAccountWalletObject<\n Type extends {\n type: AccountWalletType;\n id: AccountWalletId;\n groups: {\n [groupId: AccountGroupId]: AccountGroupObject;\n };\n metadata: {\n name: string;\n };\n },\n> = Type;\n\n/**\n * Account wallet object for the \"entropy\" wallet category.\n */\nexport type AccountWalletEntropyObject = {\n type: AccountWalletType.Entropy;\n id: MultichainAccountWalletId;\n groups: {\n // NOTE: Using `MultichainAccountGroupId` instead of `AccountGroupId` would introduce\n // some type problems when using a group ID as an `AccountGroupId` directly. This\n // would require some up-cast to a `MultichainAccountGroupId` which could be considered\n // unsafe... So we keep it as a `AccountGroupId` for now.\n [groupId: AccountGroupId]: AccountGroupMultichainAccountObject;\n };\n metadata: {\n name: string;\n entropy: {\n id: EntropySourceId;\n index: number;\n };\n };\n};\n\n/**\n * Account wallet object for the \"snap\" wallet category.\n */\nexport type AccountWalletSnapObject = {\n type: AccountWalletType.Snap;\n id: AccountWalletId;\n groups: {\n [groupId: AccountGroupId]: AccountGroupSingleAccountObject;\n };\n metadata: {\n name: string;\n snap: {\n id: SnapId;\n };\n };\n};\n\n/**\n * Account wallet object for the \"keyring\" wallet category.\n */\nexport type AccountWalletKeyringObject = {\n type: AccountWalletType.Keyring;\n id: AccountWalletId;\n groups: {\n [groupId: AccountGroupId]: AccountGroupSingleAccountObject;\n };\n metadata: {\n name: string;\n keyring: {\n type: KeyringTypes;\n };\n };\n};\n\n/**\n * Account wallet metadata for the \"keyring\" wallet category.\n */\nexport type AccountWalletObject = IsAccountWalletObject<\n | AccountWalletEntropyObject\n | AccountWalletSnapObject\n | AccountWalletKeyringObject\n>;\n\nexport type AccountWalletObjectOf<WalletType extends AccountWalletType> =\n Extract<\n | { type: AccountWalletType.Entropy; object: AccountWalletEntropyObject }\n | { type: AccountWalletType.Keyring; object: AccountWalletKeyringObject }\n | { type: AccountWalletType.Snap; object: AccountWalletSnapObject },\n { type: WalletType }\n >['object'];\n\n/**\n * Account wallet coming from the {@link AccountTreeController}.\n */\nexport class AccountTreeWallet implements AccountWallet<InternalAccount> {\n readonly #wallet: AccountWalletObject;\n\n protected messenger: AccountTreeControllerMessenger;\n\n protected groups: Map<AccountGroupId, AccountTreeGroup>;\n\n constructor({\n messenger,\n wallet,\n }: {\n messenger: AccountTreeControllerMessenger;\n wallet: AccountWalletObject;\n }) {\n this.messenger = messenger;\n this.#wallet = wallet;\n this.groups = new Map();\n\n for (const [groupId, group] of Object.entries(this.#wallet.groups)) {\n this.groups.set(\n groupId as AccountGroupId,\n new AccountTreeGroup({\n messenger: this.messenger,\n wallet: this,\n group,\n }),\n );\n }\n }\n\n get id(): AccountWalletId {\n return this.#wallet.id;\n }\n\n get type(): AccountWalletType {\n return this.#wallet.type;\n }\n\n get name(): string {\n return this.#wallet.metadata.name;\n }\n\n /**\n * Gets account tree group for a given ID.\n *\n * @param groupId - Group ID.\n * @returns Account tree group, or undefined if not found.\n */\n getAccountGroup(groupId: AccountGroupId): AccountTreeGroup | undefined {\n return this.groups.get(groupId);\n }\n\n /**\n * Gets account tree group for a given ID.\n *\n * @param groupId - Group ID.\n * @throws If the account group is not found.\n * @returns Account tree group.\n */\n getAccountGroupOrThrow(groupId: AccountGroupId): AccountTreeGroup {\n const group = this.getAccountGroup(groupId);\n if (!group) {\n throw new Error('Unable to get account group');\n }\n\n return group;\n }\n\n /**\n * Gets all account tree groups.\n *\n * @returns Account tree groups.\n */\n getAccountGroups(): AccountTreeGroup[] {\n return Array.from(this.groups.values());\n }\n}\n"]}
|
package/package.json
CHANGED
package/dist/type-utils.cjs
DELETED
package/dist/type-utils.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type-utils.cjs","sourceRoot":"","sources":["../src/type-utils.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Updatable field with timestamp tracking for persistence and synchronization.\n */\nexport type UpdatableField<T> = {\n value: T;\n lastUpdatedAt: number;\n};\n\n/**\n * Type utility to extract value from UpdatableField or return field as-is.\n */\nexport type ExtractFieldValue<Field> =\n Field extends UpdatableField<unknown> ? Field['value'] : Field;\n\n/**\n * Type utility to extract plain values from an object with UpdatableField properties.\n */\nexport type ExtractFieldValues<ObjectValue extends Record<string, unknown>> = {\n [Key in keyof ObjectValue]: ExtractFieldValue<ObjectValue[Key]>;\n};\n\n/**\n * Type utility to extract plain values and make all properties required (for tree objects).\n */\nexport type ExtractRequiredFieldValues<\n ObjectValue extends Record<string, unknown>,\n> = {\n [Key in keyof ObjectValue]-?: ExtractFieldValue<ObjectValue[Key]>;\n};\n"]}
|
package/dist/type-utils.d.cts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Updatable field with timestamp tracking for persistence and synchronization.
|
|
3
|
-
*/
|
|
4
|
-
export type UpdatableField<T> = {
|
|
5
|
-
value: T;
|
|
6
|
-
lastUpdatedAt: number;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Type utility to extract value from UpdatableField or return field as-is.
|
|
10
|
-
*/
|
|
11
|
-
export type ExtractFieldValue<Field> = Field extends UpdatableField<unknown> ? Field['value'] : Field;
|
|
12
|
-
/**
|
|
13
|
-
* Type utility to extract plain values from an object with UpdatableField properties.
|
|
14
|
-
*/
|
|
15
|
-
export type ExtractFieldValues<ObjectValue extends Record<string, unknown>> = {
|
|
16
|
-
[Key in keyof ObjectValue]: ExtractFieldValue<ObjectValue[Key]>;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Type utility to extract plain values and make all properties required (for tree objects).
|
|
20
|
-
*/
|
|
21
|
-
export type ExtractRequiredFieldValues<ObjectValue extends Record<string, unknown>> = {
|
|
22
|
-
[Key in keyof ObjectValue]-?: ExtractFieldValue<ObjectValue[Key]>;
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=type-utils.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type-utils.d.cts","sourceRoot":"","sources":["../src/type-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;IAC9B,KAAK,EAAE,CAAC,CAAC;IACT,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,KAAK,IACjC,KAAK,SAAS,cAAc,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;KAC3E,GAAG,IAAI,MAAM,WAAW,GAAG,iBAAiB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;CAChE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,0BAA0B,CACpC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACzC;KACD,GAAG,IAAI,MAAM,WAAW,CAAC,CAAC,GAAG,iBAAiB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;CAClE,CAAC"}
|
package/dist/type-utils.d.mts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Updatable field with timestamp tracking for persistence and synchronization.
|
|
3
|
-
*/
|
|
4
|
-
export type UpdatableField<T> = {
|
|
5
|
-
value: T;
|
|
6
|
-
lastUpdatedAt: number;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Type utility to extract value from UpdatableField or return field as-is.
|
|
10
|
-
*/
|
|
11
|
-
export type ExtractFieldValue<Field> = Field extends UpdatableField<unknown> ? Field['value'] : Field;
|
|
12
|
-
/**
|
|
13
|
-
* Type utility to extract plain values from an object with UpdatableField properties.
|
|
14
|
-
*/
|
|
15
|
-
export type ExtractFieldValues<ObjectValue extends Record<string, unknown>> = {
|
|
16
|
-
[Key in keyof ObjectValue]: ExtractFieldValue<ObjectValue[Key]>;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Type utility to extract plain values and make all properties required (for tree objects).
|
|
20
|
-
*/
|
|
21
|
-
export type ExtractRequiredFieldValues<ObjectValue extends Record<string, unknown>> = {
|
|
22
|
-
[Key in keyof ObjectValue]-?: ExtractFieldValue<ObjectValue[Key]>;
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=type-utils.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type-utils.d.mts","sourceRoot":"","sources":["../src/type-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;IAC9B,KAAK,EAAE,CAAC,CAAC;IACT,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,KAAK,IACjC,KAAK,SAAS,cAAc,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;KAC3E,GAAG,IAAI,MAAM,WAAW,GAAG,iBAAiB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;CAChE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,0BAA0B,CACpC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACzC;KACD,GAAG,IAAI,MAAM,WAAW,CAAC,CAAC,GAAG,iBAAiB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;CAClE,CAAC"}
|
package/dist/type-utils.mjs
DELETED
package/dist/type-utils.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type-utils.mjs","sourceRoot":"","sources":["../src/type-utils.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Updatable field with timestamp tracking for persistence and synchronization.\n */\nexport type UpdatableField<T> = {\n value: T;\n lastUpdatedAt: number;\n};\n\n/**\n * Type utility to extract value from UpdatableField or return field as-is.\n */\nexport type ExtractFieldValue<Field> =\n Field extends UpdatableField<unknown> ? Field['value'] : Field;\n\n/**\n * Type utility to extract plain values from an object with UpdatableField properties.\n */\nexport type ExtractFieldValues<ObjectValue extends Record<string, unknown>> = {\n [Key in keyof ObjectValue]: ExtractFieldValue<ObjectValue[Key]>;\n};\n\n/**\n * Type utility to extract plain values and make all properties required (for tree objects).\n */\nexport type ExtractRequiredFieldValues<\n ObjectValue extends Record<string, unknown>,\n> = {\n [Key in keyof ObjectValue]-?: ExtractFieldValue<ObjectValue[Key]>;\n};\n"]}
|