@metamask/money-account-upgrade-controller 1.1.0 → 1.3.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.
- package/CHANGELOG.md +26 -1
- package/dist/steps/associate-address.cjs +7 -7
- package/dist/steps/associate-address.cjs.map +1 -1
- package/dist/steps/associate-address.d.cts +5 -4
- package/dist/steps/associate-address.d.cts.map +1 -1
- package/dist/steps/associate-address.d.mts +5 -4
- package/dist/steps/associate-address.d.mts.map +1 -1
- package/dist/steps/associate-address.mjs +7 -7
- package/dist/steps/associate-address.mjs.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.3.0]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Bump `@metamask/chomp-api-service` from `^2.0.0` to `^3.0.0` ([#8651](https://github.com/MetaMask/core/pull/8651))
|
|
15
|
+
- Bump `@metamask/messenger` from `^1.1.1` to `^1.2.0` ([#8632](https://github.com/MetaMask/core/pull/8632))
|
|
16
|
+
- Bump `@metamask/keyring-controller` from `^25.2.0` to `^25.3.0` ([#8634](https://github.com/MetaMask/core/pull/8634))
|
|
17
|
+
- Bump `@metamask/network-controller` from `^30.0.1` to `^30.1.0` ([#8636](https://github.com/MetaMask/core/pull/8636))
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Fix the associate-address step to detect the already-associated case via `status: 'active'`. ([#8635](https://github.com/MetaMask/core/pull/8635))
|
|
22
|
+
|
|
23
|
+
## [1.2.0]
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- Bump `@metamask/chomp-api-service` from `^1.0.0` to `^2.0.0` ([#8618](https://github.com/MetaMask/core/pull/8618))
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- Send the CHOMP authentication timestamp as a number instead of a string in the associate-address step. ([#8610](https://github.com/MetaMask/core/pull/8610))
|
|
32
|
+
|
|
10
33
|
## [1.1.0]
|
|
11
34
|
|
|
12
35
|
### Added
|
|
@@ -19,6 +42,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
19
42
|
|
|
20
43
|
- Add `MoneyAccountUpgradeController` with `upgradeAccount` method ([#8426](https://github.com/MetaMask/core/pull/8426))
|
|
21
44
|
|
|
22
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/money-account-upgrade-controller@1.
|
|
45
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/money-account-upgrade-controller@1.3.0...HEAD
|
|
46
|
+
[1.3.0]: https://github.com/MetaMask/core/compare/@metamask/money-account-upgrade-controller@1.2.0...@metamask/money-account-upgrade-controller@1.3.0
|
|
47
|
+
[1.2.0]: https://github.com/MetaMask/core/compare/@metamask/money-account-upgrade-controller@1.1.0...@metamask/money-account-upgrade-controller@1.2.0
|
|
23
48
|
[1.1.0]: https://github.com/MetaMask/core/compare/@metamask/money-account-upgrade-controller@1.0.0...@metamask/money-account-upgrade-controller@1.1.0
|
|
24
49
|
[1.0.0]: https://github.com/MetaMask/core/releases/tag/@metamask/money-account-upgrade-controller@1.0.0
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.associateAddressStep = void 0;
|
|
4
|
-
const ALREADY_ASSOCIATED_STATUS = 'already_associated';
|
|
5
4
|
/**
|
|
6
5
|
* Associates the Money Account address with the user's CHOMP profile.
|
|
7
6
|
*
|
|
@@ -9,15 +8,16 @@ const ALREADY_ASSOCIATED_STATUS = 'already_associated';
|
|
|
9
8
|
* and submits the signature to CHOMP, which verifies the timestamp is fresh,
|
|
10
9
|
* recovers the signer, and records the profile–address mapping.
|
|
11
10
|
*
|
|
12
|
-
* CHOMP responds with 201 and `status: 'created'` when
|
|
13
|
-
* made, and 409 with `status: '
|
|
14
|
-
*
|
|
15
|
-
* step reports `'already-done'` for the 409 case and
|
|
11
|
+
* CHOMP responds with 201 and `status: 'created'` when a new association is
|
|
12
|
+
* made, and 409 with `status: 'active'` when the address is already
|
|
13
|
+
* associated with the authenticated profile. The service surfaces both
|
|
14
|
+
* responses, so this step reports `'already-done'` for the 409 case and
|
|
15
|
+
* `'completed'` otherwise.
|
|
16
16
|
*/
|
|
17
17
|
exports.associateAddressStep = {
|
|
18
18
|
name: 'associate-address',
|
|
19
19
|
async run({ messenger, address }) {
|
|
20
|
-
const timestamp = Date.now()
|
|
20
|
+
const timestamp = Date.now();
|
|
21
21
|
const message = `CHOMP Authentication ${timestamp}`;
|
|
22
22
|
const signature = (await messenger.call('KeyringController:signPersonalMessage', { data: message, from: address }));
|
|
23
23
|
const response = await messenger.call('ChompApiService:associateAddress', {
|
|
@@ -25,7 +25,7 @@ exports.associateAddressStep = {
|
|
|
25
25
|
timestamp,
|
|
26
26
|
address,
|
|
27
27
|
});
|
|
28
|
-
if (response.status ===
|
|
28
|
+
if (response.status === 'active') {
|
|
29
29
|
return 'already-done';
|
|
30
30
|
}
|
|
31
31
|
return 'completed';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"associate-address.cjs","sourceRoot":"","sources":["../../src/steps/associate-address.ts"],"names":[],"mappings":";;;AAIA
|
|
1
|
+
{"version":3,"file":"associate-address.cjs","sourceRoot":"","sources":["../../src/steps/associate-address.ts"],"names":[],"mappings":";;;AAIA;;;;;;;;;;;;GAYG;AACU,QAAA,oBAAoB,GAAS;IACxC,IAAI,EAAE,mBAAmB;IACzB,KAAK,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE;QAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,wBAAwB,SAAS,EAAE,CAAC;QAEpD,MAAM,SAAS,GAAG,CAAC,MAAM,SAAS,CAAC,IAAI,CACrC,uCAAuC,EACvC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CACjC,CAAQ,CAAC;QAEV,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,kCAAkC,EAAE;YACxE,SAAS;YACT,SAAS;YACT,OAAO;SACR,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YACjC,OAAO,cAAc,CAAC;QACxB,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF,CAAC","sourcesContent":["import type { Hex } from '@metamask/utils';\n\nimport type { Step } from './step';\n\n/**\n * Associates the Money Account address with the user's CHOMP profile.\n *\n * Signs `CHOMP Authentication {timestamp}` (EIP-191) with the account's key\n * and submits the signature to CHOMP, which verifies the timestamp is fresh,\n * recovers the signer, and records the profile–address mapping.\n *\n * CHOMP responds with 201 and `status: 'created'` when a new association is\n * made, and 409 with `status: 'active'` when the address is already\n * associated with the authenticated profile. The service surfaces both\n * responses, so this step reports `'already-done'` for the 409 case and\n * `'completed'` otherwise.\n */\nexport const associateAddressStep: Step = {\n name: 'associate-address',\n async run({ messenger, address }) {\n const timestamp = Date.now();\n const message = `CHOMP Authentication ${timestamp}`;\n\n const signature = (await messenger.call(\n 'KeyringController:signPersonalMessage',\n { data: message, from: address },\n )) as Hex;\n\n const response = await messenger.call('ChompApiService:associateAddress', {\n signature,\n timestamp,\n address,\n });\n\n if (response.status === 'active') {\n return 'already-done';\n }\n\n return 'completed';\n },\n};\n"]}
|
|
@@ -6,10 +6,11 @@ import type { Step } from "./step.cjs";
|
|
|
6
6
|
* and submits the signature to CHOMP, which verifies the timestamp is fresh,
|
|
7
7
|
* recovers the signer, and records the profile–address mapping.
|
|
8
8
|
*
|
|
9
|
-
* CHOMP responds with 201 and `status: 'created'` when
|
|
10
|
-
* made, and 409 with `status: '
|
|
11
|
-
*
|
|
12
|
-
* step reports `'already-done'` for the 409 case and
|
|
9
|
+
* CHOMP responds with 201 and `status: 'created'` when a new association is
|
|
10
|
+
* made, and 409 with `status: 'active'` when the address is already
|
|
11
|
+
* associated with the authenticated profile. The service surfaces both
|
|
12
|
+
* responses, so this step reports `'already-done'` for the 409 case and
|
|
13
|
+
* `'completed'` otherwise.
|
|
13
14
|
*/
|
|
14
15
|
export declare const associateAddressStep: Step;
|
|
15
16
|
//# sourceMappingURL=associate-address.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"associate-address.d.cts","sourceRoot":"","sources":["../../src/steps/associate-address.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,mBAAe;
|
|
1
|
+
{"version":3,"file":"associate-address.d.cts","sourceRoot":"","sources":["../../src/steps/associate-address.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,mBAAe;AAEnC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB,EAAE,IAuBlC,CAAC"}
|
|
@@ -6,10 +6,11 @@ import type { Step } from "./step.mjs";
|
|
|
6
6
|
* and submits the signature to CHOMP, which verifies the timestamp is fresh,
|
|
7
7
|
* recovers the signer, and records the profile–address mapping.
|
|
8
8
|
*
|
|
9
|
-
* CHOMP responds with 201 and `status: 'created'` when
|
|
10
|
-
* made, and 409 with `status: '
|
|
11
|
-
*
|
|
12
|
-
* step reports `'already-done'` for the 409 case and
|
|
9
|
+
* CHOMP responds with 201 and `status: 'created'` when a new association is
|
|
10
|
+
* made, and 409 with `status: 'active'` when the address is already
|
|
11
|
+
* associated with the authenticated profile. The service surfaces both
|
|
12
|
+
* responses, so this step reports `'already-done'` for the 409 case and
|
|
13
|
+
* `'completed'` otherwise.
|
|
13
14
|
*/
|
|
14
15
|
export declare const associateAddressStep: Step;
|
|
15
16
|
//# sourceMappingURL=associate-address.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"associate-address.d.mts","sourceRoot":"","sources":["../../src/steps/associate-address.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,mBAAe;
|
|
1
|
+
{"version":3,"file":"associate-address.d.mts","sourceRoot":"","sources":["../../src/steps/associate-address.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,mBAAe;AAEnC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB,EAAE,IAuBlC,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
const ALREADY_ASSOCIATED_STATUS = 'already_associated';
|
|
2
1
|
/**
|
|
3
2
|
* Associates the Money Account address with the user's CHOMP profile.
|
|
4
3
|
*
|
|
@@ -6,15 +5,16 @@ const ALREADY_ASSOCIATED_STATUS = 'already_associated';
|
|
|
6
5
|
* and submits the signature to CHOMP, which verifies the timestamp is fresh,
|
|
7
6
|
* recovers the signer, and records the profile–address mapping.
|
|
8
7
|
*
|
|
9
|
-
* CHOMP responds with 201 and `status: 'created'` when
|
|
10
|
-
* made, and 409 with `status: '
|
|
11
|
-
*
|
|
12
|
-
* step reports `'already-done'` for the 409 case and
|
|
8
|
+
* CHOMP responds with 201 and `status: 'created'` when a new association is
|
|
9
|
+
* made, and 409 with `status: 'active'` when the address is already
|
|
10
|
+
* associated with the authenticated profile. The service surfaces both
|
|
11
|
+
* responses, so this step reports `'already-done'` for the 409 case and
|
|
12
|
+
* `'completed'` otherwise.
|
|
13
13
|
*/
|
|
14
14
|
export const associateAddressStep = {
|
|
15
15
|
name: 'associate-address',
|
|
16
16
|
async run({ messenger, address }) {
|
|
17
|
-
const timestamp = Date.now()
|
|
17
|
+
const timestamp = Date.now();
|
|
18
18
|
const message = `CHOMP Authentication ${timestamp}`;
|
|
19
19
|
const signature = (await messenger.call('KeyringController:signPersonalMessage', { data: message, from: address }));
|
|
20
20
|
const response = await messenger.call('ChompApiService:associateAddress', {
|
|
@@ -22,7 +22,7 @@ export const associateAddressStep = {
|
|
|
22
22
|
timestamp,
|
|
23
23
|
address,
|
|
24
24
|
});
|
|
25
|
-
if (response.status ===
|
|
25
|
+
if (response.status === 'active') {
|
|
26
26
|
return 'already-done';
|
|
27
27
|
}
|
|
28
28
|
return 'completed';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"associate-address.mjs","sourceRoot":"","sources":["../../src/steps/associate-address.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"associate-address.mjs","sourceRoot":"","sources":["../../src/steps/associate-address.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAS;IACxC,IAAI,EAAE,mBAAmB;IACzB,KAAK,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE;QAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,wBAAwB,SAAS,EAAE,CAAC;QAEpD,MAAM,SAAS,GAAG,CAAC,MAAM,SAAS,CAAC,IAAI,CACrC,uCAAuC,EACvC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CACjC,CAAQ,CAAC;QAEV,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,kCAAkC,EAAE;YACxE,SAAS;YACT,SAAS;YACT,OAAO;SACR,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YACjC,OAAO,cAAc,CAAC;QACxB,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CACF,CAAC","sourcesContent":["import type { Hex } from '@metamask/utils';\n\nimport type { Step } from './step';\n\n/**\n * Associates the Money Account address with the user's CHOMP profile.\n *\n * Signs `CHOMP Authentication {timestamp}` (EIP-191) with the account's key\n * and submits the signature to CHOMP, which verifies the timestamp is fresh,\n * recovers the signer, and records the profile–address mapping.\n *\n * CHOMP responds with 201 and `status: 'created'` when a new association is\n * made, and 409 with `status: 'active'` when the address is already\n * associated with the authenticated profile. The service surfaces both\n * responses, so this step reports `'already-done'` for the 409 case and\n * `'completed'` otherwise.\n */\nexport const associateAddressStep: Step = {\n name: 'associate-address',\n async run({ messenger, address }) {\n const timestamp = Date.now();\n const message = `CHOMP Authentication ${timestamp}`;\n\n const signature = (await messenger.call(\n 'KeyringController:signPersonalMessage',\n { data: message, from: address },\n )) as Hex;\n\n const response = await messenger.call('ChompApiService:associateAddress', {\n signature,\n timestamp,\n address,\n });\n\n if (response.status === 'active') {\n return 'already-done';\n }\n\n return 'completed';\n },\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/money-account-upgrade-controller",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "MetaMask Money account upgrade controller",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ethereum",
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@metamask/base-controller": "^9.1.0",
|
|
57
|
-
"@metamask/chomp-api-service": "^
|
|
58
|
-
"@metamask/keyring-controller": "^25.
|
|
59
|
-
"@metamask/messenger": "^1.
|
|
60
|
-
"@metamask/network-controller": "^30.0
|
|
57
|
+
"@metamask/chomp-api-service": "^3.0.0",
|
|
58
|
+
"@metamask/keyring-controller": "^25.3.0",
|
|
59
|
+
"@metamask/messenger": "^1.2.0",
|
|
60
|
+
"@metamask/network-controller": "^30.1.0",
|
|
61
61
|
"@metamask/utils": "^11.9.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|