@metamask-previews/chomp-api-service 6.0.1-preview-601bac5ab → 6.0.1-preview-7fb08ad32
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 -20
- package/dist/chomp-api-service-method-action-types.d.ts +13 -96
- package/dist/chomp-api-service-method-action-types.d.ts.map +1 -1
- package/dist/chomp-api-service-method-action-types.js.map +1 -1
- package/dist/chomp-api-service.d.ts +10 -99
- package/dist/chomp-api-service.d.ts.map +1 -1
- package/dist/chomp-api-service.js +25 -274
- package/dist/chomp-api-service.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +6 -109
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +13 -10
package/CHANGELOG.md
CHANGED
|
@@ -7,26 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
### Added
|
|
11
|
-
|
|
12
|
-
- Add `getDerivedIdentities` method, also expose it through the messenger as `ChompApiService:getDerivedIdentities` ([#10695](https://github.com/MetaMask/core/pull/10695))
|
|
13
|
-
- Add `getDerivedIdentityByAddress` method, and expose it through the messenger as `ChompApiService:getDerivedIdentityByAddress` ([#10695](https://github.com/MetaMask/core/pull/10695))
|
|
14
|
-
- Add `disassociateAddress` method for `DELETE /v1/auth/address`, and expose it through the messenger as `ChompApiService:disassociateAddress` ([#10695](https://github.com/MetaMask/core/pull/10695))
|
|
15
|
-
- For an address linked as a successor, this cancels the Money Account migration and unfreezes its predecessor. CHOMP rejects this with `LINK_COMPLETE` once a funds-transfer request exists for the migration.
|
|
16
|
-
- The request is never retried.
|
|
17
|
-
- Add `AddressIdentityResponse`, `DerivedIdentitiesResponse`, `DerivedIdentity`, `DerivedIdentityAddressRole`, `DerivedIdentityMigration`, `DerivedIdentityStatus`, `MigrationStep`, `MigrationStepState`, `MigrationTransfer`, `ChompApiServiceDisassociateAddressAction`, `ChompApiServiceGetDerivedIdentitiesAction`, and `ChompApiServiceGetDerivedIdentityByAddressAction` types ([#10695](https://github.com/MetaMask/core/pull/10695))
|
|
18
|
-
- Add `createAddressChallenge` method for `POST /v2/auth/address/challenge`, and expose it through the messenger as `ChompApiService:createAddressChallenge` ([#10687](https://github.com/MetaMask/core/pull/10687))
|
|
19
|
-
- Returns a single-use SIWE message bound to the profile, chain, purpose and address. The `ASSOCIATE_SUCCESSOR` purpose takes a `predecessorAddress` to link the address as the successor of an existing Money Account.
|
|
20
|
-
- Add `associateAddressV2` method for `POST /v2/auth/address`, and expose it through the messenger as `ChompApiService:associateAddressV2` ([#10687](https://github.com/MetaMask/core/pull/10687))
|
|
21
|
-
- Submits the signed challenge message to associate the address.
|
|
22
|
-
- Add `ChompApiError`, thrown for non-2xx responses, which exposes the CHOMP error code from the response body as `code` ([#10687](https://github.com/MetaMask/core/pull/10687))
|
|
23
|
-
- Add `AssociationPurpose`, `CreateAddressChallengeParams`, `CreateAddressChallengeResponse`, `AssociateAddressV2Params`, `ChompApiServiceCreateAddressChallengeAction`, and `ChompApiServiceAssociateAddressV2Action` types ([#10687](https://github.com/MetaMask/core/pull/10687))
|
|
24
|
-
- Add support for Node.js 26 ([#10981](https://github.com/MetaMask/core/pull/10981))
|
|
25
|
-
|
|
26
|
-
### Removed
|
|
27
|
-
|
|
28
|
-
- **BREAKING:** Remove the `associateAddress` method and `ChompApiService:associateAddress` messenger action (`POST /v1/auth/address`), along with the `AssociateAddressParams` and `ChompApiServiceAssociateAddressAction` types ([#10687](https://github.com/MetaMask/core/pull/10687))
|
|
29
|
-
|
|
30
10
|
## [6.0.1]
|
|
31
11
|
|
|
32
12
|
### Changed
|
|
@@ -4,62 +4,20 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { ChompApiService } from './chomp-api-service.js';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
* flow. Sign the returned `message` exactly as received, using
|
|
9
|
-
* `personal_sign` with the address being associated, then submit it with
|
|
10
|
-
* {@link ChompApiService.associateAddressV2} before `expiresAt`. Requesting
|
|
11
|
-
* a new challenge for the same address replaces the previous one.
|
|
7
|
+
* Associates an address with a CHOMP profile.
|
|
12
8
|
*
|
|
13
|
-
* POST /
|
|
9
|
+
* POST /v1/auth/address
|
|
14
10
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @
|
|
18
|
-
* `
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
export type ChompApiServiceCreateAddressChallengeAction = {
|
|
22
|
-
type: `ChompApiService:createAddressChallenge`;
|
|
23
|
-
handler: ChompApiService['createAddressChallenge'];
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Associates an address with a CHOMP profile by submitting the signature of
|
|
27
|
-
* a challenge from {@link ChompApiService.createAddressChallenge}. The
|
|
28
|
-
* address, purpose and predecessor come from the challenge. For
|
|
29
|
-
* `ASSOCIATE_SUCCESSOR`, the association and the link to the predecessor
|
|
30
|
-
* are written atomically.
|
|
31
|
-
*
|
|
32
|
-
* POST /v2/auth/address
|
|
33
|
-
*
|
|
34
|
-
* @param params - The challenge ID and its signature.
|
|
35
|
-
* @returns The profile association result: `status: 'created'` when the
|
|
36
|
-
* association or link was written, `status: 'active'` when the address was
|
|
37
|
-
* already associated with the authenticated profile. Throws on 400
|
|
38
|
-
* `CHALLENGE_INVALID_OR_EXPIRED` (request a new challenge), on 409 when the
|
|
39
|
-
* address is associated with a different profile, and on link validation
|
|
40
|
-
* errors.
|
|
11
|
+
* @param params - The association params containing signature, timestamp,
|
|
12
|
+
* and address.
|
|
13
|
+
* @returns The profile association result: `status: 'created'` for a new
|
|
14
|
+
* association, `status: 'active'` when the address was already associated
|
|
15
|
+
* with the authenticated profile. Throws on 409, which indicates the
|
|
16
|
+
* address is associated with a different profile.
|
|
41
17
|
*/
|
|
42
|
-
export type
|
|
43
|
-
type: `ChompApiService:
|
|
44
|
-
handler: ChompApiService['
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Removes an address association from the authenticated profile. For an
|
|
48
|
-
* address linked as a successor, this cancels the migration and unfreezes
|
|
49
|
-
* its predecessor. CHOMP rejects the cancellation with `LINK_COMPLETE` once
|
|
50
|
-
* a funds-transfer request exists for the link, which can happen before
|
|
51
|
-
* the migration is `DONE`.
|
|
52
|
-
*
|
|
53
|
-
* DELETE /v1/auth/address
|
|
54
|
-
*
|
|
55
|
-
* Executed as a mutation so it is never retried: a retry after a lost
|
|
56
|
-
* response would hit an already-removed address and fail with a 404.
|
|
57
|
-
*
|
|
58
|
-
* @param address - The address to disassociate.
|
|
59
|
-
*/
|
|
60
|
-
export type ChompApiServiceDisassociateAddressAction = {
|
|
61
|
-
type: `ChompApiService:disassociateAddress`;
|
|
62
|
-
handler: ChompApiService['disassociateAddress'];
|
|
18
|
+
export type ChompApiServiceAssociateAddressAction = {
|
|
19
|
+
type: `ChompApiService:associateAddress`;
|
|
20
|
+
handler: ChompApiService['associateAddress'];
|
|
63
21
|
};
|
|
64
22
|
/**
|
|
65
23
|
* Fetches the addresses associated with the authenticated profile.
|
|
@@ -141,8 +99,7 @@ export type ChompApiServiceCreateIntentsAction = {
|
|
|
141
99
|
* is always fetched fresh (`staleTime: 0`).
|
|
142
100
|
*
|
|
143
101
|
* @param address - The address to look up intents for.
|
|
144
|
-
* @returns The array of intents for the address
|
|
145
|
-
* intent type this service does not recognise.
|
|
102
|
+
* @returns The array of intents for the address.
|
|
146
103
|
*/
|
|
147
104
|
export type ChompApiServiceGetIntentsByAddressAction = {
|
|
148
105
|
type: `ChompApiService:getIntentsByAddress`;
|
|
@@ -175,48 +132,8 @@ export type ChompApiServiceGetServiceDetailsAction = {
|
|
|
175
132
|
type: `ChompApiService:getServiceDetails`;
|
|
176
133
|
handler: ChompApiService['getServiceDetails'];
|
|
177
134
|
};
|
|
178
|
-
/**
|
|
179
|
-
* Fetches the Money Account identities of the authenticated profile, with
|
|
180
|
-
* the status and migration steps CHOMP derives on every read. When funds
|
|
181
|
-
* transfer is the only missing step, CHOMP creates the transfer request as
|
|
182
|
-
* part of the read, after which the migration can no longer be cancelled.
|
|
183
|
-
*
|
|
184
|
-
* GET /v1/money-account/identities
|
|
185
|
-
*
|
|
186
|
-
* Profile-scoped and used to drive migrations, so it is always fetched
|
|
187
|
-
* fresh and keyed by a digest of the bearer token, like
|
|
188
|
-
* {@link ChompApiService.getAssociatedAddresses}.
|
|
189
|
-
*
|
|
190
|
-
* @returns The identities; empty when the profile has no Money Account.
|
|
191
|
-
* Addresses are lowercased.
|
|
192
|
-
*/
|
|
193
|
-
export type ChompApiServiceGetDerivedIdentitiesAction = {
|
|
194
|
-
type: `ChompApiService:getDerivedIdentities`;
|
|
195
|
-
handler: ChompApiService['getDerivedIdentities'];
|
|
196
|
-
};
|
|
197
|
-
/**
|
|
198
|
-
* Fetches the identity containing an address, along with where the address
|
|
199
|
-
* sits in it. The identity's `status` describes the whole chain. Like
|
|
200
|
-
* {@link ChompApiService.getDerivedIdentities}, this read can create the
|
|
201
|
-
* migration's funds-transfer request.
|
|
202
|
-
*
|
|
203
|
-
* GET /v1/money-account/identities/address/:address
|
|
204
|
-
*
|
|
205
|
-
* Always fetched fresh and keyed by a digest of the bearer token, like
|
|
206
|
-
* {@link ChompApiService.getDerivedIdentities}.
|
|
207
|
-
*
|
|
208
|
-
* @param address - The address to look up.
|
|
209
|
-
* @returns The identity and address details, or `null` when CHOMP responds
|
|
210
|
-
* with `ADDRESS_NOT_ASSOCIATED`: the address is not associated with the
|
|
211
|
-
* authenticated profile, or it is but belongs to no Money Account.
|
|
212
|
-
* Addresses are lowercased.
|
|
213
|
-
*/
|
|
214
|
-
export type ChompApiServiceGetDerivedIdentityByAddressAction = {
|
|
215
|
-
type: `ChompApiService:getDerivedIdentityByAddress`;
|
|
216
|
-
handler: ChompApiService['getDerivedIdentityByAddress'];
|
|
217
|
-
};
|
|
218
135
|
/**
|
|
219
136
|
* Union of all ChompApiService action types.
|
|
220
137
|
*/
|
|
221
|
-
export type ChompApiServiceMethodActions =
|
|
138
|
+
export type ChompApiServiceMethodActions = ChompApiServiceAssociateAddressAction | ChompApiServiceGetAssociatedAddressesAction | ChompApiServiceCreateUpgradeAction | ChompApiServiceGetUpgradesAction | ChompApiServiceVerifyDelegationAction | ChompApiServiceCreateIntentsAction | ChompApiServiceGetIntentsByAddressAction | ChompApiServiceCreateWithdrawalAction | ChompApiServiceGetServiceDetailsAction;
|
|
222
139
|
//# sourceMappingURL=chomp-api-service-method-action-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chomp-api-service-method-action-types.d.ts","sourceRoot":"","sources":["../src/chomp-api-service-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D
|
|
1
|
+
{"version":3,"file":"chomp-api-service-method-action-types.d.ts","sourceRoot":"","sources":["../src/chomp-api-service-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE,wCAAwC,CAAC;IAC/C,OAAO,EAAE,eAAe,CAAC,wBAAwB,CAAC,CAAC;CACpD,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,eAAe,CAAC,eAAe,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC7C,IAAI,EAAE,6BAA6B,CAAC;IACpC,OAAO,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;CACzC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,eAAe,CAAC,eAAe,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC;CACjD,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,eAAe,CAAC,mBAAmB,CAAC,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,4BAA4B,GACpC,qCAAqC,GACrC,2CAA2C,GAC3C,kCAAkC,GAClC,gCAAgC,GAChC,qCAAqC,GACrC,kCAAkC,GAClC,wCAAwC,GACxC,qCAAqC,GACrC,sCAAsC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chomp-api-service-method-action-types.js","sourceRoot":"","sources":["../src/chomp-api-service-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { ChompApiService } from './chomp-api-service.js';\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"chomp-api-service-method-action-types.js","sourceRoot":"","sources":["../src/chomp-api-service-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { ChompApiService } from './chomp-api-service.js';\n\n/**\n * Associates an address with a CHOMP profile.\n *\n * POST /v1/auth/address\n *\n * @param params - The association params containing signature, timestamp,\n * and address.\n * @returns The profile association result: `status: 'created'` for a new\n * association, `status: 'active'` when the address was already associated\n * with the authenticated profile. Throws on 409, which indicates the\n * address is associated with a different profile.\n */\nexport type ChompApiServiceAssociateAddressAction = {\n type: `ChompApiService:associateAddress`;\n handler: ChompApiService['associateAddress'];\n};\n\n/**\n * Fetches the addresses associated with the authenticated profile.\n *\n * GET /v1/auth/address\n *\n * The result is scoped to the authenticated profile and consumers use it\n * to decide whether an association already exists, so it is always fetched\n * fresh (`staleTime: 0`) and evicted as soon as the call settles\n * (`gcTime: 0`). The query key carries a SHA-256 digest of the bearer\n * token — the same token the request is made with — so concurrent calls\n * only share an in-flight request when they are for the same profile. The\n * digest, not the token, is used because query keys leave the service via\n * the `cacheUpdated` messenger events.\n *\n * @returns The active address associations; empty array if none exist.\n * Addresses are lowercased.\n */\nexport type ChompApiServiceGetAssociatedAddressesAction = {\n type: `ChompApiService:getAssociatedAddresses`;\n handler: ChompApiService['getAssociatedAddresses'];\n};\n\n/**\n * Creates an account upgrade request.\n *\n * POST /v1/account-upgrade\n *\n * @param params - The upgrade params containing signature components and\n * chain details.\n * @returns The upgrade result.\n */\nexport type ChompApiServiceCreateUpgradeAction = {\n type: `ChompApiService:createUpgrade`;\n handler: ChompApiService['createUpgrade'];\n};\n\n/**\n * Fetches all EIP-7702 upgrade authorizations for a given address (one per\n * chain).\n *\n * GET /v1/account-upgrade/:address\n *\n * @param address - The address to look up.\n * @returns The upgrade entries; empty array if none exist.\n */\nexport type ChompApiServiceGetUpgradesAction = {\n type: `ChompApiService:getUpgrades`;\n handler: ChompApiService['getUpgrades'];\n};\n\n/**\n * Verifies a delegation signature.\n *\n * POST /v1/intent/verify-delegation\n *\n * @param params - The delegation verification params.\n * @returns The verification result including validity and optional errors.\n */\nexport type ChompApiServiceVerifyDelegationAction = {\n type: `ChompApiService:verifyDelegation`;\n handler: ChompApiService['verifyDelegation'];\n};\n\n/**\n * Submits one or more intents to the CHOMP API.\n *\n * POST /v1/intent\n *\n * @param intents - The array of intents to submit.\n * @returns The array of intent responses.\n */\nexport type ChompApiServiceCreateIntentsAction = {\n type: `ChompApiService:createIntents`;\n handler: ChompApiService['createIntents'];\n};\n\n/**\n * Fetches intents associated with a given address.\n *\n * GET /v1/intent/account/:address\n *\n * Callers use the result to decide whether an intent already exists, so it\n * is always fetched fresh (`staleTime: 0`).\n *\n * @param address - The address to look up intents for.\n * @returns The array of intents for the address.\n */\nexport type ChompApiServiceGetIntentsByAddressAction = {\n type: `ChompApiService:getIntentsByAddress`;\n handler: ChompApiService['getIntentsByAddress'];\n};\n\n/**\n * Creates a withdrawal for card spend flows.\n *\n * POST /v1/withdrawal\n *\n * @param params - The withdrawal params containing chainId, amount\n * (decimal or hex string), and account address.\n * @returns The withdrawal result.\n */\nexport type ChompApiServiceCreateWithdrawalAction = {\n type: `ChompApiService:createWithdrawal`;\n handler: ChompApiService['createWithdrawal'];\n};\n\n/**\n * Retrieves service details including delegation redeemer addresses and DeFi\n * contract details for signing delegations for auto-deposit functionality.\n *\n * GET /v1/chomp\n *\n * @param chainIds - Array of chain IDs (0x-prefixed hex strings) to retrieve\n * details for.\n * @returns The service details for the requested chains.\n */\nexport type ChompApiServiceGetServiceDetailsAction = {\n type: `ChompApiService:getServiceDetails`;\n handler: ChompApiService['getServiceDetails'];\n};\n\n/**\n * Union of all ChompApiService action types.\n */\nexport type ChompApiServiceMethodActions =\n | ChompApiServiceAssociateAddressAction\n | ChompApiServiceGetAssociatedAddressesAction\n | ChompApiServiceCreateUpgradeAction\n | ChompApiServiceGetUpgradesAction\n | ChompApiServiceVerifyDelegationAction\n | ChompApiServiceCreateIntentsAction\n | ChompApiServiceGetIntentsByAddressAction\n | ChompApiServiceCreateWithdrawalAction\n | ChompApiServiceGetServiceDetailsAction;\n"]}
|
|
@@ -1,35 +1,16 @@
|
|
|
1
1
|
import { BaseDataService } from '@metamask/base-data-service';
|
|
2
2
|
import type { DataServiceCacheUpdatedEvent, DataServiceGranularCacheUpdatedEvent, DataServiceInvalidateQueriesAction } from '@metamask/base-data-service';
|
|
3
3
|
import type { CreateServicePolicyOptions } from '@metamask/controller-utils';
|
|
4
|
-
import { HttpError } from '@metamask/controller-utils';
|
|
5
4
|
import type { Messenger } from '@metamask/messenger';
|
|
6
5
|
import type { Hex } from '@metamask/utils';
|
|
7
6
|
import type { QueryClientConfig } from '@tanstack/query-core';
|
|
8
7
|
import type { ChompApiServiceMethodActions } from './chomp-api-service-method-action-types.js';
|
|
9
|
-
import type {
|
|
8
|
+
import type { AssociateAddressParams, AssociateAddressResponse, ProfileAddressEntry, CreateUpgradeParams, CreateUpgradeResponse, UpgradeEntry, CreateWithdrawalParams, CreateWithdrawalResponse, IntentEntry, SendIntentParams, SendIntentResponse, ServiceDetailsResponse, VerifyDelegationParams, VerifyDelegationResponse } from './types.js';
|
|
10
9
|
/**
|
|
11
10
|
* The name of the {@link ChompApiService}, used to namespace the service's
|
|
12
11
|
* actions and events.
|
|
13
12
|
*/
|
|
14
13
|
export declare const serviceName = "ChompApiService";
|
|
15
|
-
/**
|
|
16
|
-
* Thrown when the CHOMP API responds with a non-2xx status.
|
|
17
|
-
*/
|
|
18
|
-
export declare class ChompApiError extends HttpError {
|
|
19
|
-
/**
|
|
20
|
-
* The CHOMP error code from the response body (e.g.
|
|
21
|
-
* `PREDECESSOR_HAS_OPEN_WITHDRAWALS`), if one was provided.
|
|
22
|
-
*/
|
|
23
|
-
readonly code: string | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Construct a CHOMP API error.
|
|
26
|
-
*
|
|
27
|
-
* @param status - The HTTP response status.
|
|
28
|
-
* @param message - The error message.
|
|
29
|
-
* @param code - The CHOMP error code from the response body.
|
|
30
|
-
*/
|
|
31
|
-
constructor(status: number, message: string, code?: string);
|
|
32
|
-
}
|
|
33
14
|
/**
|
|
34
15
|
* Invalidates cached queries for {@link ChompApiService}.
|
|
35
16
|
*/
|
|
@@ -91,54 +72,18 @@ export declare class ChompApiService extends BaseDataService<typeof serviceName,
|
|
|
91
72
|
policyOptions?: CreateServicePolicyOptions;
|
|
92
73
|
});
|
|
93
74
|
/**
|
|
94
|
-
*
|
|
95
|
-
* flow. Sign the returned `message` exactly as received, using
|
|
96
|
-
* `personal_sign` with the address being associated, then submit it with
|
|
97
|
-
* {@link ChompApiService.associateAddressV2} before `expiresAt`. Requesting
|
|
98
|
-
* a new challenge for the same address replaces the previous one.
|
|
75
|
+
* Associates an address with a CHOMP profile.
|
|
99
76
|
*
|
|
100
|
-
* POST /
|
|
77
|
+
* POST /v1/auth/address
|
|
101
78
|
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* @
|
|
105
|
-
* `
|
|
106
|
-
*
|
|
107
|
-
|
|
108
|
-
createAddressChallenge(params: CreateAddressChallengeParams): Promise<CreateAddressChallengeResponse>;
|
|
109
|
-
/**
|
|
110
|
-
* Associates an address with a CHOMP profile by submitting the signature of
|
|
111
|
-
* a challenge from {@link ChompApiService.createAddressChallenge}. The
|
|
112
|
-
* address, purpose and predecessor come from the challenge. For
|
|
113
|
-
* `ASSOCIATE_SUCCESSOR`, the association and the link to the predecessor
|
|
114
|
-
* are written atomically.
|
|
115
|
-
*
|
|
116
|
-
* POST /v2/auth/address
|
|
117
|
-
*
|
|
118
|
-
* @param params - The challenge ID and its signature.
|
|
119
|
-
* @returns The profile association result: `status: 'created'` when the
|
|
120
|
-
* association or link was written, `status: 'active'` when the address was
|
|
121
|
-
* already associated with the authenticated profile. Throws on 400
|
|
122
|
-
* `CHALLENGE_INVALID_OR_EXPIRED` (request a new challenge), on 409 when the
|
|
123
|
-
* address is associated with a different profile, and on link validation
|
|
124
|
-
* errors.
|
|
79
|
+
* @param params - The association params containing signature, timestamp,
|
|
80
|
+
* and address.
|
|
81
|
+
* @returns The profile association result: `status: 'created'` for a new
|
|
82
|
+
* association, `status: 'active'` when the address was already associated
|
|
83
|
+
* with the authenticated profile. Throws on 409, which indicates the
|
|
84
|
+
* address is associated with a different profile.
|
|
125
85
|
*/
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Removes an address association from the authenticated profile. For an
|
|
129
|
-
* address linked as a successor, this cancels the migration and unfreezes
|
|
130
|
-
* its predecessor. CHOMP rejects the cancellation with `LINK_COMPLETE` once
|
|
131
|
-
* a funds-transfer request exists for the link, which can happen before
|
|
132
|
-
* the migration is `DONE`.
|
|
133
|
-
*
|
|
134
|
-
* DELETE /v1/auth/address
|
|
135
|
-
*
|
|
136
|
-
* Executed as a mutation so it is never retried: a retry after a lost
|
|
137
|
-
* response would hit an already-removed address and fail with a 404.
|
|
138
|
-
*
|
|
139
|
-
* @param address - The address to disassociate.
|
|
140
|
-
*/
|
|
141
|
-
disassociateAddress(address: Hex): Promise<void>;
|
|
86
|
+
associateAddress(params: AssociateAddressParams): Promise<AssociateAddressResponse>;
|
|
142
87
|
/**
|
|
143
88
|
* Fetches the addresses associated with the authenticated profile.
|
|
144
89
|
*
|
|
@@ -229,40 +174,6 @@ export declare class ChompApiService extends BaseDataService<typeof serviceName,
|
|
|
229
174
|
* @returns The service details for the requested chains.
|
|
230
175
|
*/
|
|
231
176
|
getServiceDetails(chainIds: Hex[]): Promise<ServiceDetailsResponse>;
|
|
232
|
-
/**
|
|
233
|
-
* Fetches the Money Account identities of the authenticated profile, with
|
|
234
|
-
* the status and migration steps CHOMP derives on every read. When funds
|
|
235
|
-
* transfer is the only missing step, CHOMP creates the transfer request as
|
|
236
|
-
* part of the read, after which the migration can no longer be cancelled.
|
|
237
|
-
*
|
|
238
|
-
* GET /v1/money-account/identities
|
|
239
|
-
*
|
|
240
|
-
* Profile-scoped and used to drive migrations, so it is always fetched
|
|
241
|
-
* fresh and keyed by a digest of the bearer token, like
|
|
242
|
-
* {@link ChompApiService.getAssociatedAddresses}.
|
|
243
|
-
*
|
|
244
|
-
* @returns The identities; empty when the profile has no Money Account.
|
|
245
|
-
* Addresses are lowercased.
|
|
246
|
-
*/
|
|
247
|
-
getDerivedIdentities(): Promise<DerivedIdentitiesResponse>;
|
|
248
|
-
/**
|
|
249
|
-
* Fetches the identity containing an address, along with where the address
|
|
250
|
-
* sits in it. The identity's `status` describes the whole chain. Like
|
|
251
|
-
* {@link ChompApiService.getDerivedIdentities}, this read can create the
|
|
252
|
-
* migration's funds-transfer request.
|
|
253
|
-
*
|
|
254
|
-
* GET /v1/money-account/identities/address/:address
|
|
255
|
-
*
|
|
256
|
-
* Always fetched fresh and keyed by a digest of the bearer token, like
|
|
257
|
-
* {@link ChompApiService.getDerivedIdentities}.
|
|
258
|
-
*
|
|
259
|
-
* @param address - The address to look up.
|
|
260
|
-
* @returns The identity and address details, or `null` when CHOMP responds
|
|
261
|
-
* with `ADDRESS_NOT_ASSOCIATED`: the address is not associated with the
|
|
262
|
-
* authenticated profile, or it is but belongs to no Money Account.
|
|
263
|
-
* Addresses are lowercased.
|
|
264
|
-
*/
|
|
265
|
-
getDerivedIdentityByAddress(address: Hex): Promise<AddressIdentityResponse | null>;
|
|
266
177
|
}
|
|
267
178
|
export {};
|
|
268
179
|
//# sourceMappingURL=chomp-api-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chomp-api-service.d.ts","sourceRoot":"","sources":["../src/chomp-api-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EACV,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EACnC,MAAM,6BAA6B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