@metamask-previews/chomp-api-service 4.0.1-preview-3e34650c2 → 4.0.1-preview-4f4c98e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/dist/{chomp-api-service-method-action-types.d.mts → chomp-api-service-method-action-types.d.ts} +2 -2
  3. package/dist/chomp-api-service-method-action-types.d.ts.map +1 -0
  4. package/dist/{chomp-api-service-method-action-types.mjs → chomp-api-service-method-action-types.js} +1 -1
  5. package/dist/chomp-api-service-method-action-types.js.map +1 -0
  6. package/dist/{chomp-api-service.d.cts → chomp-api-service.d.ts} +9 -9
  7. package/dist/chomp-api-service.d.ts.map +1 -0
  8. package/dist/{chomp-api-service.mjs → chomp-api-service.js} +5 -5
  9. package/dist/chomp-api-service.js.map +1 -0
  10. package/dist/{index.d.cts → index.d.ts} +5 -5
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +2 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/{types.d.cts → types.d.ts} +2 -2
  15. package/dist/types.d.ts.map +1 -0
  16. package/dist/types.js +2 -0
  17. package/dist/types.js.map +1 -0
  18. package/package.json +12 -16
  19. package/dist/chomp-api-service-method-action-types.cjs +0 -7
  20. package/dist/chomp-api-service-method-action-types.cjs.map +0 -1
  21. package/dist/chomp-api-service-method-action-types.d.cts +0 -133
  22. package/dist/chomp-api-service-method-action-types.d.cts.map +0 -1
  23. package/dist/chomp-api-service-method-action-types.d.mts.map +0 -1
  24. package/dist/chomp-api-service-method-action-types.mjs.map +0 -1
  25. package/dist/chomp-api-service.cjs +0 -451
  26. package/dist/chomp-api-service.cjs.map +0 -1
  27. package/dist/chomp-api-service.d.cts.map +0 -1
  28. package/dist/chomp-api-service.d.mts +0 -175
  29. package/dist/chomp-api-service.d.mts.map +0 -1
  30. package/dist/chomp-api-service.mjs.map +0 -1
  31. package/dist/index.cjs +0 -6
  32. package/dist/index.cjs.map +0 -1
  33. package/dist/index.d.cts.map +0 -1
  34. package/dist/index.d.mts +0 -5
  35. package/dist/index.d.mts.map +0 -1
  36. package/dist/index.mjs +0 -2
  37. package/dist/index.mjs.map +0 -1
  38. package/dist/types.cjs +0 -3
  39. package/dist/types.cjs.map +0 -1
  40. package/dist/types.d.cts.map +0 -1
  41. package/dist/types.d.mts +0 -162
  42. package/dist/types.d.mts.map +0 -1
  43. package/dist/types.mjs +0 -2
  44. package/dist/types.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
26
26
 
27
27
  ### Changed
28
28
 
29
+ - **BREAKING:** Bump minimum Node.js version to 22 ([#9168](https://github.com/MetaMask/core/pull/9168))
29
30
  - **BREAKING:** `associateAddress` now throws an `HttpError` on a 409 response instead of returning the parsed body ([#9387](https://github.com/MetaMask/core/pull/9387))
30
31
  - A 409 from `POST /v1/auth/address` indicates the address is associated with a _different_ profile; the previous handling attempted to parse the error body as an association result and failed with a confusing validation error. An address already associated with the authenticated profile is reported via a 201 response with `status: 'active'`, which is unchanged.
31
32
  - Bump `@metamask/utils` from `^11.9.0` to `^11.11.0` ([#9074](https://github.com/MetaMask/core/pull/9074))
@@ -2,7 +2,7 @@
2
2
  * This file is auto generated.
3
3
  * Do not edit manually.
4
4
  */
5
- import type { ChompApiService } from "./chomp-api-service.mjs";
5
+ import type { ChompApiService } from './chomp-api-service.js';
6
6
  /**
7
7
  * Associates an address with a CHOMP profile.
8
8
  *
@@ -130,4 +130,4 @@ export type ChompApiServiceGetServiceDetailsAction = {
130
130
  * Union of all ChompApiService action types.
131
131
  */
132
132
  export type ChompApiServiceMethodActions = ChompApiServiceAssociateAddressAction | ChompApiServiceGetAssociatedAddressesAction | ChompApiServiceCreateUpgradeAction | ChompApiServiceGetUpgradesAction | ChompApiServiceVerifyDelegationAction | ChompApiServiceCreateIntentsAction | ChompApiServiceGetIntentsByAddressAction | ChompApiServiceCreateWithdrawalAction | ChompApiServiceGetServiceDetailsAction;
133
- //# sourceMappingURL=chomp-api-service-method-action-types.d.mts.map
133
+ //# sourceMappingURL=chomp-api-service-method-action-types.d.ts.map
@@ -0,0 +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;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;;;;;;;;GAaG;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;;;;;;;GAOG;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"}
@@ -3,4 +3,4 @@
3
3
  * Do not edit manually.
4
4
  */
5
5
  export {};
6
- //# sourceMappingURL=chomp-api-service-method-action-types.mjs.map
6
+ //# sourceMappingURL=chomp-api-service-method-action-types.js.map
@@ -0,0 +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 * 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 to\n * decide whether an association already exists, so it is always fetched\n * fresh (`staleTime: 0`, `cacheTime: 0`) and the query key is scoped to the\n * profile via a digest of the bearer token — concurrent calls only share a\n * request when they are for the same profile.\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 * @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,11 +1,11 @@
1
- import { BaseDataService } from "@metamask/base-data-service";
2
- import type { DataServiceCacheUpdatedEvent, DataServiceGranularCacheUpdatedEvent, DataServiceInvalidateQueriesAction } from "@metamask/base-data-service";
3
- import type { CreateServicePolicyOptions } from "@metamask/controller-utils";
4
- import type { Messenger } from "@metamask/messenger";
5
- import type { Hex } from "@metamask/utils";
6
- import type { QueryClientConfig } from "@tanstack/query-core";
7
- import type { ChompApiServiceMethodActions } from "./chomp-api-service-method-action-types.cjs";
8
- import type { AssociateAddressParams, AssociateAddressResponse, ProfileAddressEntry, CreateUpgradeParams, CreateUpgradeResponse, UpgradeEntry, CreateWithdrawalParams, CreateWithdrawalResponse, IntentEntry, SendIntentParams, SendIntentResponse, ServiceDetailsResponse, VerifyDelegationParams, VerifyDelegationResponse } from "./types.cjs";
1
+ import { BaseDataService } from '@metamask/base-data-service';
2
+ import type { DataServiceCacheUpdatedEvent, DataServiceGranularCacheUpdatedEvent, DataServiceInvalidateQueriesAction } from '@metamask/base-data-service';
3
+ import type { CreateServicePolicyOptions } from '@metamask/controller-utils';
4
+ import type { Messenger } from '@metamask/messenger';
5
+ import type { Hex } from '@metamask/utils';
6
+ import type { QueryClientConfig } from '@tanstack/query-core';
7
+ import type { ChompApiServiceMethodActions } from './chomp-api-service-method-action-types.js';
8
+ import type { AssociateAddressParams, AssociateAddressResponse, ProfileAddressEntry, CreateUpgradeParams, CreateUpgradeResponse, UpgradeEntry, CreateWithdrawalParams, CreateWithdrawalResponse, IntentEntry, SendIntentParams, SendIntentResponse, ServiceDetailsResponse, VerifyDelegationParams, VerifyDelegationResponse } from './types.js';
9
9
  /**
10
10
  * The name of the {@link ChompApiService}, used to namespace the service's
11
11
  * actions and events.
@@ -172,4 +172,4 @@ export declare class ChompApiService extends BaseDataService<typeof serviceName,
172
172
  getServiceDetails(chainIds: Hex[]): Promise<ServiceDetailsResponse>;
173
173
  }
174
174
  export {};
175
- //# sourceMappingURL=chomp-api-service.d.cts.map
175
+ //# sourceMappingURL=chomp-api-service.d.ts.map
@@ -0,0 +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,CAAC;AACrC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAE7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAcrD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAO3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,C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Y,EACV,SAAS,EACT,OAAO,EACP,iBAAsB,EACtB,aAAkB,GACnB,EAAE;QACD,SAAS,EAAE,wBAAwB,CAAC;QACpC,OAAO,EAAE,MAAM,CAAC;QAChB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;QACtC,aAAa,CAAC,EAAE,0BAA0B,CAAC;KAC5C,EAcA;IA4BD;;;;;;;;;;;OAWG;IACG,gBAAgB,CACpB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,wBAAwB,CAAC,CA2BnC;IAED;;;;;;;;;;;;;;;;OAgBG;IACG,sBAAsB,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC,CA4B7D;IAED;;;;;;;;OAQG;IACG,aAAa,CACjB,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,qBAAqB,CAAC,CA2BhC;IAED;;;;;;;;OAQG;IACG,WAAW,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAsBvD;IAED;;;;;;;OAOG;IACG,gBAAgB,CACpB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,wBAAwB,CAAC,CA2BnC;IAED;;;;;;;OAOG;IACG,aAAa,CACjB,OAAO,EAAE,gBAAgB,EAAE,GAC1B,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAwB/B;IAED;;;;;;;OAOG;IACG,mBAAmB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAsB9D;IAED;;;;;;;;OAQG;IACG,gBAAgB,CACpB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,wBAAwB,CAAC,CAwBnC;IAED;;;;;;;;;OASG;IACG,iBAAiB,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAqBxE;CACF"}
@@ -10,10 +10,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
12
  var _ChompApiService_instances, _ChompApiService_baseUrl, _ChompApiService_headersForToken, _ChompApiService_authHeaders;
13
- import { BaseDataService } from "@metamask/base-data-service";
14
- import { handleWhen, HttpError } from "@metamask/controller-utils";
15
- import { array, boolean, coerce, create, enums, literal, number, optional, record, string, type } from "@metamask/superstruct";
16
- import { bytesToHex, sha256, stringToBytes, StrictHexStruct } from "@metamask/utils";
13
+ import { BaseDataService } from '@metamask/base-data-service';
14
+ import { handleWhen, HttpError } from '@metamask/controller-utils';
15
+ import { array, boolean, coerce, create, enums, literal, number, optional, record, string, type, } from '@metamask/superstruct';
16
+ import { bytesToHex, sha256, stringToBytes, StrictHexStruct, } from '@metamask/utils';
17
17
  // === GENERAL ===
18
18
  /**
19
19
  * The name of the {@link ChompApiService}, used to namespace the service's
@@ -444,4 +444,4 @@ async function _ChompApiService_authHeaders() {
444
444
  const token = await this.messenger.call('AuthenticationController:getBearerToken');
445
445
  return __classPrivateFieldGet(this, _ChompApiService_instances, "m", _ChompApiService_headersForToken).call(this, token);
446
446
  };
447
- //# sourceMappingURL=chomp-api-service.mjs.map
447
+ //# sourceMappingURL=chomp-api-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chomp-api-service.js","sourceRoot":"","sources":["../src/chomp-api-service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAO9D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,EACR,MAAM,EACN,MAAM,EACN,IAAI,GACL,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,UAAU,EACV,MAAM,EACN,aAAa,EACb,eAAe,GAChB,MAAM,iBAAiB,CAAC;AAqBzB,kBAAkB;AAElB;;;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e,CAAC;gBAC1C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,WAAW,EAAE,uBAAA,IAAI,gCAAS,CAAC,CAAC;gBAChD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;gBACpD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;gBAE/C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;oBACjB,MAAM,IAAI,SAAS,CACjB,QAAQ,CAAC,MAAM,EACf,qCAAqC,QAAQ,CAAC,MAAM,GAAG,CACxD,CAAC;gBACJ,CAAC;gBAED,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;YACzB,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC,YAAY,EAAE,4BAA4B,CAAC,CAAC;IAC5D,CAAC;CACF;mKAtWkB,KAAa;IAC5B,OAAO;QACL,aAAa,EAAE,UAAU,KAAK,EAAE;QAChC,cAAc,EAAE,kBAAkB;KACnC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,KAAK;IACH,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CACrC,yCAAyC,CAC1C,CAAC;IACF,OAAO,uBAAA,IAAI,oEAAiB,MAArB,IAAI,EAAkB,KAAK,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import { BaseDataService } from '@metamask/base-data-service';\nimport type {\n DataServiceCacheUpdatedEvent,\n DataServiceGranularCacheUpdatedEvent,\n DataServiceInvalidateQueriesAction,\n} from '@metamask/base-data-service';\nimport type { CreateServicePolicyOptions } from '@metamask/controller-utils';\nimport { handleWhen, HttpError } from '@metamask/controller-utils';\nimport type { Messenger } from '@metamask/messenger';\nimport {\n array,\n boolean,\n coerce,\n create,\n enums,\n literal,\n number,\n optional,\n record,\n string,\n type,\n} from '@metamask/superstruct';\nimport type { Hex } from '@metamask/utils';\nimport {\n bytesToHex,\n sha256,\n stringToBytes,\n StrictHexStruct,\n} from '@metamask/utils';\nimport type { QueryClientConfig } from '@tanstack/query-core';\n\nimport type { ChompApiServiceMethodActions } from './chomp-api-service-method-action-types.js';\nimport type {\n AssociateAddressParams,\n AssociateAddressResponse,\n ProfileAddressEntry,\n CreateUpgradeParams,\n CreateUpgradeResponse,\n UpgradeEntry,\n CreateWithdrawalParams,\n CreateWithdrawalResponse,\n IntentEntry,\n SendIntentParams,\n SendIntentResponse,\n ServiceDetailsResponse,\n VerifyDelegationParams,\n VerifyDelegationResponse,\n} from './types.js';\n\n// === GENERAL ===\n\n/**\n * The name of the {@link ChompApiService}, used to namespace the service's\n * actions and events.\n */\nexport const serviceName = 'ChompApiService';\n\n// === MESSENGER ===\n\n/**\n * All of the methods within {@link ChompApiService} that are exposed via the\n * messenger.\n */\nconst MESSENGER_EXPOSED_METHODS = [\n 'associateAddress',\n 'getAssociatedAddresses',\n 'createUpgrade',\n 'getUpgrades',\n 'verifyDelegation',\n 'createIntents',\n 'getIntentsByAddress',\n 'createWithdrawal',\n 'getServiceDetails',\n] as const;\n\n/**\n * Invalidates cached queries for {@link ChompApiService}.\n */\nexport type ChompApiServiceInvalidateQueriesAction =\n DataServiceInvalidateQueriesAction<typeof serviceName>;\n\n/**\n * Actions that {@link ChompApiService} exposes to other consumers.\n */\nexport type ChompApiServiceActions =\n | ChompApiServiceMethodActions\n | ChompApiServiceInvalidateQueriesAction;\n\n/**\n * Actions from other messengers that {@link ChompApiService} calls.\n */\ntype AllowedActions = {\n type: 'AuthenticationController:getBearerToken';\n handler: (entropySourceId?: string) => Promise<string>;\n};\n\n/**\n * Published when {@link ChompApiService}'s cache is updated.\n */\nexport type ChompApiServiceCacheUpdatedEvent = DataServiceCacheUpdatedEvent<\n typeof serviceName\n>;\n\n/**\n * Published when a key within {@link ChompApiService}'s cache is updated.\n */\nexport type ChompApiServiceGranularCacheUpdatedEvent =\n DataServiceGranularCacheUpdatedEvent<typeof serviceName>;\n\n/**\n * Events that {@link ChompApiService} exposes to other consumers.\n */\nexport type ChompApiServiceEvents =\n | ChompApiServiceCacheUpdatedEvent\n | ChompApiServiceGranularCacheUpdatedEvent;\n\n/**\n * Events from other messengers that {@link ChompApiService} subscribes to.\n */\ntype AllowedEvents = never;\n\n/**\n * The messenger which is restricted to actions and events accessed by\n * {@link ChompApiService}.\n */\nexport type ChompApiServiceMessenger = Messenger<\n typeof serviceName,\n ChompApiServiceActions | AllowedActions,\n ChompApiServiceEvents | AllowedEvents\n>;\n\n// === RESPONSE VALIDATION ===\n\nconst AssociateAddressResponseStruct = type({\n profileId: optional(string()),\n address: StrictHexStruct,\n status: enums(['active', 'created']),\n});\n\n/**\n * Parses addresses into canonical lowercase form. CHOMP stores and returns\n * addresses lowercased, but `StrictHexStruct` alone accepts any casing, so\n * this makes the canonical form a guarantee of the parsed data rather than a\n * convention consumers must each remember.\n */\nconst LowercaseHexAddressStruct = coerce(StrictHexStruct, string(), (value) =>\n value.toLowerCase(),\n);\n\nconst ProfileAddressEntryArrayStruct = array(\n type({\n profileId: string(),\n address: LowercaseHexAddressStruct,\n status: enums(['active']),\n }),\n);\n\nconst AccountUpgradeStatusStruct = enums(['pending', 'upgraded']);\n\nconst AuthorizationDataStruct = type({\n r: StrictHexStruct,\n s: StrictHexStruct,\n v: number(),\n yParity: number(),\n address: StrictHexStruct,\n chainId: StrictHexStruct,\n nonce: StrictHexStruct,\n});\n\nconst CreateUpgradeResponseStruct = type({\n signerAddress: StrictHexStruct,\n address: StrictHexStruct,\n chainId: StrictHexStruct,\n nonce: StrictHexStruct,\n status: AccountUpgradeStatusStruct,\n createdAt: string(),\n});\n\nconst UpgradeEntryArrayStruct = array(\n type({\n signerAddress: StrictHexStruct,\n chainId: StrictHexStruct,\n nonce: StrictHexStruct,\n authorization: AuthorizationDataStruct,\n status: AccountUpgradeStatusStruct,\n createdAt: string(),\n }),\n);\n\nconst VerifyDelegationResponseStruct = type({\n valid: boolean(),\n delegationHash: optional(StrictHexStruct),\n errors: optional(array(string())),\n});\n\nconst SendIntentResponseArrayStruct = array(\n type({\n delegationHash: StrictHexStruct,\n metadata: type({\n allowance: StrictHexStruct,\n tokenSymbol: string(),\n tokenAddress: StrictHexStruct,\n type: enums(['cash-deposit', 'cash-withdrawal']),\n }),\n createdAt: string(),\n }),\n);\n\nconst IntentEntryArrayStruct = array(\n type({\n account: StrictHexStruct,\n delegationHash: StrictHexStruct,\n chainId: StrictHexStruct,\n status: enums(['active', 'revoked']),\n metadata: type({\n allowance: StrictHexStruct,\n tokenAddress: StrictHexStruct,\n tokenSymbol: string(),\n type: enums(['cash-deposit', 'cash-withdrawal']),\n }),\n }),\n);\n\nconst CreateWithdrawalResponseStruct = type({\n success: literal(true),\n});\n\nconst ServiceDetailsProtocolStruct = type({\n supportedTokens: array(\n type({\n tokenAddress: StrictHexStruct,\n tokenDecimals: number(),\n }),\n ),\n adapterAddress: StrictHexStruct,\n intentTypes: array(enums(['cash-deposit', 'cash-withdrawal'])),\n});\n\nconst ServiceDetailsResponseStruct = type({\n auth: type({\n message: string(),\n }),\n chains: record(\n StrictHexStruct,\n type({\n autoDepositDelegate: StrictHexStruct,\n protocol: record(string(), ServiceDetailsProtocolStruct),\n }),\n ),\n});\n\n// === RETRY POLICY ===\n\n/**\n * Determines whether an error from a CHOMP API call is worth retrying.\n *\n * 4xx responses (e.g. 409 \"already exists\", 400 validation, 401/403 auth) are\n * caused by the request itself and will not be resolved by re-issuing the same\n * request, so they bypass the retry loop. 429 is treated as transient and\n * retried alongside 5xx server errors. Non-HTTP errors (network/timeout) fall\n * through to the default \"retry\" behaviour.\n *\n * @param error - The error thrown by the query function.\n * @returns `true` when the error is worth retrying.\n */\nfunction isRetryableError(error: unknown): boolean {\n if (error instanceof HttpError) {\n if (error.httpStatus === 429) {\n return true;\n }\n return error.httpStatus < 400 || error.httpStatus >= 500;\n }\n return true;\n}\n\nconst DEFAULT_POLICY_OPTIONS: CreateServicePolicyOptions = {\n retryFilterPolicy: handleWhen(isRetryableError),\n};\n\n// === SERVICE DEFINITION ===\n\n/**\n * This service is responsible for communicating with the CHOMP API.\n *\n * All requests are authenticated via JWT Bearer tokens obtained from the\n * `AuthenticationController:getBearerToken` messenger action.\n */\nexport class ChompApiService extends BaseDataService<\n typeof serviceName,\n ChompApiServiceMessenger\n> {\n readonly #baseUrl: string;\n\n /**\n * Constructs a new ChompApiService.\n *\n * @param args - The constructor arguments.\n * @param args.messenger - The messenger suited for this service.\n * @param args.baseUrl - The base URL of the CHOMP API.\n * @param args.queryClientConfig - Configuration for the underlying TanStack\n * Query client.\n * @param args.policyOptions - Options to pass to `createServicePolicy`.\n */\n constructor({\n messenger,\n baseUrl,\n queryClientConfig = {},\n policyOptions = {},\n }: {\n messenger: ChompApiServiceMessenger;\n baseUrl: string;\n queryClientConfig?: QueryClientConfig;\n policyOptions?: CreateServicePolicyOptions;\n }) {\n super({\n name: serviceName,\n messenger,\n queryClientConfig,\n policyOptions: { ...DEFAULT_POLICY_OPTIONS, ...policyOptions },\n });\n\n this.#baseUrl = baseUrl;\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n /**\n * Builds the standard headers for a CHOMP API request authenticated with\n * the given bearer token.\n *\n * @param token - The bearer token to authenticate with.\n * @returns Headers including Authorization and Content-Type.\n */\n #headersForToken(token: string): Record<string, string> {\n return {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/json',\n };\n }\n\n /**\n * Builds the standard headers for an authenticated CHOMP API request.\n *\n * @returns Headers including Authorization and Content-Type.\n */\n async #authHeaders(): Promise<Record<string, string>> {\n const token = await this.messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n return this.#headersForToken(token);\n }\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 */\n async associateAddress(\n params: AssociateAddressParams,\n ): Promise<AssociateAddressResponse> {\n const jsonResponse = await this.fetchQuery({\n queryKey: [`${this.name}:associateAddress`, params],\n staleTime: 0,\n queryFn: async () => {\n const headers = await this.#authHeaders();\n const response = await fetch(\n new URL('/v1/auth/address', this.#baseUrl),\n {\n method: 'POST',\n headers,\n body: JSON.stringify(params),\n },\n );\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `POST /v1/auth/address failed with status '${response.status}'`,\n );\n }\n\n return response.json();\n },\n });\n\n return create(jsonResponse, AssociateAddressResponseStruct);\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 */\n async getAssociatedAddresses(): Promise<ProfileAddressEntry[]> {\n const token = await this.messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n const profileKey = bytesToHex(await sha256(stringToBytes(token)));\n\n const jsonResponse = await this.fetchQuery({\n queryKey: [`${this.name}:getAssociatedAddresses`, profileKey],\n staleTime: 0,\n gcTime: 0,\n queryFn: async () => {\n const response = await fetch(\n new URL('/v1/auth/address', this.#baseUrl),\n { headers: this.#headersForToken(token) },\n );\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `GET /v1/auth/address failed with status '${response.status}'`,\n );\n }\n\n return response.json();\n },\n });\n\n return create(jsonResponse, ProfileAddressEntryArrayStruct);\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 */\n async createUpgrade(\n params: CreateUpgradeParams,\n ): Promise<CreateUpgradeResponse> {\n const jsonResponse = await this.fetchQuery({\n queryKey: [`${this.name}:createUpgrade`, params],\n staleTime: 0,\n queryFn: async () => {\n const headers = await this.#authHeaders();\n const response = await fetch(\n new URL('/v1/account-upgrade', this.#baseUrl),\n {\n method: 'POST',\n headers,\n body: JSON.stringify(params),\n },\n );\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `POST /v1/account-upgrade failed with status '${response.status}'`,\n );\n }\n\n return response.json();\n },\n });\n\n return create(jsonResponse, CreateUpgradeResponseStruct);\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 */\n async getUpgrades(address: Hex): Promise<UpgradeEntry[]> {\n const jsonResponse = await this.fetchQuery({\n queryKey: [`${this.name}:getUpgrades`, address],\n queryFn: async () => {\n const headers = await this.#authHeaders();\n const response = await fetch(\n new URL(`/v1/account-upgrade/${address}`, this.#baseUrl),\n { headers },\n );\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Get upgrades request failed with status '${response.status}'`,\n );\n }\n\n return response.json();\n },\n });\n\n return create(jsonResponse, UpgradeEntryArrayStruct);\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 */\n async verifyDelegation(\n params: VerifyDelegationParams,\n ): Promise<VerifyDelegationResponse> {\n const jsonResponse = await this.fetchQuery({\n queryKey: [`${this.name}:verifyDelegation`, params],\n staleTime: 0,\n queryFn: async () => {\n const headers = await this.#authHeaders();\n const response = await fetch(\n new URL('/v1/intent/verify-delegation', this.#baseUrl),\n {\n method: 'POST',\n headers,\n body: JSON.stringify(params),\n },\n );\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `POST /v1/intent/verify-delegation failed with status '${response.status}'`,\n );\n }\n\n return response.json();\n },\n });\n\n return create(jsonResponse, VerifyDelegationResponseStruct);\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 */\n async createIntents(\n intents: SendIntentParams[],\n ): Promise<SendIntentResponse[]> {\n const jsonResponse = await this.fetchQuery({\n queryKey: [`${this.name}:createIntents`, intents],\n staleTime: 0,\n queryFn: async () => {\n const headers = await this.#authHeaders();\n const response = await fetch(new URL('/v1/intent', this.#baseUrl), {\n method: 'POST',\n headers,\n body: JSON.stringify(intents),\n });\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `POST /v1/intent failed with status '${response.status}'`,\n );\n }\n\n return response.json();\n },\n });\n\n return create(jsonResponse, SendIntentResponseArrayStruct);\n }\n\n /**\n * Fetches intents associated with a given address.\n *\n * GET /v1/intent/account/:address\n *\n * @param address - The address to look up intents for.\n * @returns The array of intents for the address.\n */\n async getIntentsByAddress(address: Hex): Promise<IntentEntry[]> {\n const jsonResponse = await this.fetchQuery({\n queryKey: [`${this.name}:getIntentsByAddress`, address],\n queryFn: async () => {\n const headers = await this.#authHeaders();\n const response = await fetch(\n new URL(`/v1/intent/account/${address}`, this.#baseUrl),\n { headers },\n );\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Get intents request failed with status '${response.status}'`,\n );\n }\n\n return response.json();\n },\n });\n\n return create(jsonResponse, IntentEntryArrayStruct);\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 */\n async createWithdrawal(\n params: CreateWithdrawalParams,\n ): Promise<CreateWithdrawalResponse> {\n const jsonResponse = await this.fetchQuery({\n queryKey: [`${this.name}:createWithdrawal`, params],\n staleTime: 0,\n queryFn: async () => {\n const headers = await this.#authHeaders();\n const response = await fetch(new URL('/v1/withdrawal', this.#baseUrl), {\n method: 'POST',\n headers,\n body: JSON.stringify(params),\n });\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `POST /v1/withdrawal failed with status '${response.status}'`,\n );\n }\n\n return response.json();\n },\n });\n\n return create(jsonResponse, CreateWithdrawalResponseStruct);\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 */\n async getServiceDetails(chainIds: Hex[]): Promise<ServiceDetailsResponse> {\n const jsonResponse = await this.fetchQuery({\n queryKey: [`${this.name}:getServiceDetails`, chainIds],\n queryFn: async () => {\n const headers = await this.#authHeaders();\n const url = new URL('/v1/chomp', this.#baseUrl);\n url.searchParams.set('chainId', chainIds.join(','));\n const response = await fetch(url, { headers });\n\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `GET /v1/chomp failed with status '${response.status}'`,\n );\n }\n\n return response.json();\n },\n });\n\n return create(jsonResponse, ServiceDetailsResponseStruct);\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
- export { ChompApiService } from "./chomp-api-service.cjs";
2
- export type { ChompApiServiceMessenger, ChompApiServiceActions, ChompApiServiceEvents, ChompApiServiceInvalidateQueriesAction, ChompApiServiceCacheUpdatedEvent, ChompApiServiceGranularCacheUpdatedEvent, } from "./chomp-api-service.cjs";
3
- export type { ChompApiServiceAssociateAddressAction, ChompApiServiceGetAssociatedAddressesAction, ChompApiServiceCreateUpgradeAction, ChompApiServiceGetUpgradesAction, ChompApiServiceVerifyDelegationAction, ChompApiServiceCreateIntentsAction, ChompApiServiceGetIntentsByAddressAction, ChompApiServiceCreateWithdrawalAction, ChompApiServiceGetServiceDetailsAction, } from "./chomp-api-service-method-action-types.cjs";
4
- export type { AccountUpgradeStatus, AssociateAddressParams, AssociateAddressResponse, AuthorizationData, CreateUpgradeParams, CreateUpgradeResponse, CreateWithdrawalParams, CreateWithdrawalResponse, DelegationCaveat, UpgradeEntry, IntentEntry, IntentMetadataParams, IntentMetadataResponse, ProfileAddressEntry, SendIntentParams, SendIntentResponse, ServiceDetailsChain, ServiceDetailsProtocol, ServiceDetailsResponse, ServiceDetailsSupportedToken, SignedDelegation, VerifyDelegationParams, VerifyDelegationResponse, } from "./types.cjs";
5
- //# sourceMappingURL=index.d.cts.map
1
+ export { ChompApiService } from './chomp-api-service.js';
2
+ export type { ChompApiServiceMessenger, ChompApiServiceActions, ChompApiServiceEvents, ChompApiServiceInvalidateQueriesAction, ChompApiServiceCacheUpdatedEvent, ChompApiServiceGranularCacheUpdatedEvent, } from './chomp-api-service.js';
3
+ export type { ChompApiServiceAssociateAddressAction, ChompApiServiceGetAssociatedAddressesAction, ChompApiServiceCreateUpgradeAction, ChompApiServiceGetUpgradesAction, ChompApiServiceVerifyDelegationAction, ChompApiServiceCreateIntentsAction, ChompApiServiceGetIntentsByAddressAction, ChompApiServiceCreateWithdrawalAction, ChompApiServiceGetServiceDetailsAction, } from './chomp-api-service-method-action-types.js';
4
+ export type { AccountUpgradeStatus, AssociateAddressParams, AssociateAddressResponse, AuthorizationData, CreateUpgradeParams, CreateUpgradeResponse, CreateWithdrawalParams, CreateWithdrawalResponse, DelegationCaveat, UpgradeEntry, IntentEntry, IntentMetadataParams, IntentMetadataResponse, ProfileAddressEntry, SendIntentParams, SendIntentResponse, ServiceDetailsChain, ServiceDetailsProtocol, ServiceDetailsResponse, ServiceDetailsSupportedToken, SignedDelegation, VerifyDelegationParams, VerifyDelegationResponse, } from './types.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,YAAY,EACV,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,sCAAsC,EACtC,gCAAgC,EAChC,wCAAwC,GACzC,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,qCAAqC,EACrC,2CAA2C,EAC3C,kCAAkC,EAClC,gCAAgC,EAChC,qCAAqC,EACrC,kCAAkC,EAClC,wCAAwC,EACxC,qCAAqC,EACrC,sCAAsC,GACvC,MAAM,4CAA4C,CAAC;AACpD,YAAY,EACV,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,4BAA4B,EAC5B,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { ChompApiService } from './chomp-api-service.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["export { ChompApiService } from './chomp-api-service.js';\nexport type {\n ChompApiServiceMessenger,\n ChompApiServiceActions,\n ChompApiServiceEvents,\n ChompApiServiceInvalidateQueriesAction,\n ChompApiServiceCacheUpdatedEvent,\n ChompApiServiceGranularCacheUpdatedEvent,\n} from './chomp-api-service.js';\nexport type {\n ChompApiServiceAssociateAddressAction,\n ChompApiServiceGetAssociatedAddressesAction,\n ChompApiServiceCreateUpgradeAction,\n ChompApiServiceGetUpgradesAction,\n ChompApiServiceVerifyDelegationAction,\n ChompApiServiceCreateIntentsAction,\n ChompApiServiceGetIntentsByAddressAction,\n ChompApiServiceCreateWithdrawalAction,\n ChompApiServiceGetServiceDetailsAction,\n} from './chomp-api-service-method-action-types.js';\nexport type {\n AccountUpgradeStatus,\n AssociateAddressParams,\n AssociateAddressResponse,\n AuthorizationData,\n CreateUpgradeParams,\n CreateUpgradeResponse,\n CreateWithdrawalParams,\n CreateWithdrawalResponse,\n DelegationCaveat,\n UpgradeEntry,\n IntentEntry,\n IntentMetadataParams,\n IntentMetadataResponse,\n ProfileAddressEntry,\n SendIntentParams,\n SendIntentResponse,\n ServiceDetailsChain,\n ServiceDetailsProtocol,\n ServiceDetailsResponse,\n ServiceDetailsSupportedToken,\n SignedDelegation,\n VerifyDelegationParams,\n VerifyDelegationResponse,\n} from './types.js';\n"]}
@@ -1,4 +1,4 @@
1
- import type { Hex } from "@metamask/utils";
1
+ import type { Hex } from '@metamask/utils';
2
2
  export type DelegationCaveat = {
3
3
  enforcer: Hex;
4
4
  terms: Hex;
@@ -159,4 +159,4 @@ export type ServiceDetailsResponse = {
159
159
  };
160
160
  chains: Record<Hex, ServiceDetailsChain>;
161
161
  };
162
- //# sourceMappingURL=types.d.cts.map
162
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAI3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,GAAG,CAAC;IACd,KAAK,EAAE,GAAG,CAAC;IACX,IAAI,EAAE,GAAG,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,GAAG,CAAC;IACd,SAAS,EAAE,GAAG,CAAC;IACf,SAAS,EAAE,GAAG,CAAC;IACf,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,IAAI,EAAE,GAAG,CAAC;IACV,SAAS,EAAE,GAAG,CAAC;CAChB,CAAC;AAIF,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAA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AAsB,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,GAAG,CAAC;IACb,cAAc,EAAE,GAAG,CAAC;IACpB,OAAO,EAAE,GAAG,CAAC;IACb,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC7B,QAAQ,EAAE;QACR,SAAS,EAAE,GAAG,CAAC;QACf,YAAY,EAAE,GAAG,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,cAAc,GAAG,iBAAiB,CAAC;KAC1C,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,IAAI,CAAC;CACf,CAAC;AAIF,MAAM,MAAM,4BAA4B,GAAG;IACzC,YAAY,EAAE,GAAG,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,eAAe,EAAE,4BAA4B,EAAE,CAAC;IAChD,cAAc,EAAE,GAAG,CAAC;IACpB,WAAW,EAAE,CAAC,cAAc,GAAG,iBAAiB,CAAC,EAAE,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,mBAAmB,EAAE,GAAG,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC;CAC1C,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Hex } from '@metamask/utils';\n\n// === COMMON TYPES ===\n\nexport type DelegationCaveat = {\n enforcer: Hex;\n terms: Hex;\n args: Hex;\n};\n\nexport type SignedDelegation = {\n delegate: Hex;\n delegator: Hex;\n authority: Hex;\n caveats: DelegationCaveat[];\n salt: Hex;\n signature: Hex;\n};\n\n// === PARAMS TYPES ===\n\nexport type AssociateAddressParams = {\n signature: Hex;\n timestamp: number;\n address: Hex;\n};\n\nexport type CreateUpgradeParams = {\n r: Hex;\n s: Hex;\n v: number;\n yParity: number;\n address: Hex;\n chainId: string;\n nonce: string;\n};\n\nexport type VerifyDelegationParams = {\n signedDelegation: SignedDelegation;\n chainId: Hex;\n};\n\nexport type IntentMetadataParams = {\n allowance: Hex;\n tokenSymbol: string;\n tokenAddress: Hex;\n type: 'cash-deposit' | 'cash-withdrawal';\n};\n\nexport type SendIntentParams = {\n account: Hex;\n delegationHash: Hex;\n chainId: Hex;\n metadata: IntentMetadataParams;\n};\n\nexport type CreateWithdrawalParams = {\n chainId: Hex;\n /** Decimal integer or 0x-prefixed hex string representing the amount. */\n amount: string;\n account: Hex;\n};\n\n// === RESPONSE TYPES ===\n\n/**\n * Returned by POST /v1/auth/address.\n *\n * `profileId` is only included when the address was newly associated\n * (`status: 'created'`). When the address was already associated with the\n * authenticated profile (`status: 'active'`), only `address` is returned.\n * Both cases respond with 201; an address associated with a different\n * profile responds with 409, which is surfaced as an error.\n */\nexport type AssociateAddressResponse = {\n profileId?: string;\n address: Hex;\n status: 'active' | 'created';\n};\n\n/**\n * One entry returned by GET /v1/auth/address. The endpoint returns an array\n * of these — the active address associations of the authenticated profile\n * (the API filters out soft-deleted associations, so `status` is always\n * `'active'`). Addresses are lowercased.\n */\nexport type ProfileAddressEntry = {\n profileId: string;\n address: Hex;\n status: 'active';\n};\n\nexport type AccountUpgradeStatus = 'pending' | 'upgraded';\n\nexport type AuthorizationData = {\n r: Hex;\n s: Hex;\n v: number;\n yParity: number;\n address: Hex;\n chainId: Hex;\n nonce: Hex;\n};\n\n/**\n * Returned by POST /v1/account-upgrade.\n */\nexport type CreateUpgradeResponse = {\n signerAddress: Hex;\n address: Hex;\n chainId: Hex;\n nonce: Hex;\n status: AccountUpgradeStatus;\n createdAt: string;\n};\n\n/**\n * One entry returned by GET /v1/account-upgrade/:address. The endpoint returns\n * an array of these (one per chain).\n */\nexport type UpgradeEntry = {\n signerAddress: Hex;\n chainId: Hex;\n nonce: Hex;\n authorization: AuthorizationData;\n status: AccountUpgradeStatus;\n createdAt: string;\n};\n\nexport type VerifyDelegationResponse = {\n valid: boolean;\n delegationHash?: Hex;\n errors?: string[];\n};\n\nexport type IntentMetadataResponse = {\n allowance: Hex;\n tokenSymbol: string;\n tokenAddress: Hex;\n type: 'cash-deposit' | 'cash-withdrawal';\n};\n\nexport type SendIntentResponse = {\n delegationHash: Hex;\n metadata: IntentMetadataResponse;\n createdAt: string;\n};\n\n/**\n * The shape returned by GET /v1/intent/account/:address for each intent.\n */\nexport type IntentEntry = {\n account: Hex;\n delegationHash: Hex;\n chainId: Hex;\n status: 'active' | 'revoked';\n metadata: {\n allowance: Hex;\n tokenAddress: Hex;\n tokenSymbol: string;\n type: 'cash-deposit' | 'cash-withdrawal';\n };\n};\n\nexport type CreateWithdrawalResponse = {\n success: true;\n};\n\n// === SERVICE DETAILS TYPES ===\n\nexport type ServiceDetailsSupportedToken = {\n tokenAddress: Hex;\n tokenDecimals: number;\n};\n\nexport type ServiceDetailsProtocol = {\n supportedTokens: ServiceDetailsSupportedToken[];\n adapterAddress: Hex;\n intentTypes: ('cash-deposit' | 'cash-withdrawal')[];\n};\n\nexport type ServiceDetailsChain = {\n autoDepositDelegate: Hex;\n protocol: Record<string, ServiceDetailsProtocol>;\n};\n\nexport type ServiceDetailsResponse = {\n auth: {\n message: string;\n };\n chains: Record<Hex, ServiceDetailsChain>;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/chomp-api-service",
3
- "version": "4.0.1-preview-3e34650c2",
3
+ "version": "4.0.1-preview-4f4c98e",
4
4
  "description": "Data service for the Chomp API",
5
5
  "keywords": [
6
6
  "Ethereum",
@@ -18,19 +18,12 @@
18
18
  "files": [
19
19
  "dist/"
20
20
  ],
21
+ "type": "module",
21
22
  "sideEffects": false,
22
- "main": "./dist/index.cjs",
23
- "types": "./dist/index.d.cts",
24
23
  "exports": {
25
24
  ".": {
26
- "import": {
27
- "types": "./dist/index.d.mts",
28
- "default": "./dist/index.mjs"
29
- },
30
- "require": {
31
- "types": "./dist/index.d.cts",
32
- "default": "./dist/index.cjs"
33
- }
25
+ "types": "./dist/index.d.ts",
26
+ "default": "./dist/index.js"
34
27
  },
35
28
  "./package.json": "./package.json"
36
29
  },
@@ -39,9 +32,11 @@
39
32
  "registry": "https://registry.npmjs.org/"
40
33
  },
41
34
  "scripts": {
42
- "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
43
- "build:all": "ts-bridge --project tsconfig.build.json --verbose --clean",
35
+ "build": "tsc --project tsconfig.build.json",
36
+ "build:all": "tsc --build tsconfig.build.json --verbose",
37
+ "build:clean": "yarn build:only-clean && yarn build",
44
38
  "build:docs": "typedoc",
39
+ "build:only-clean": "rimraf './dist' './tsconfig.build.tsbuildinfo'",
45
40
  "changelog:update": "../../scripts/update-changelog.sh @metamask/chomp-api-service",
46
41
  "changelog:validate": "../../scripts/validate-changelog.sh @metamask/chomp-api-service",
47
42
  "lint:tsconfigs": "tsx ../../scripts/lint-tsconfigs/lint-tsconfigs.mts",
@@ -62,18 +57,19 @@
62
57
  },
63
58
  "devDependencies": {
64
59
  "@metamask/auto-changelog": "^6.1.0",
65
- "@ts-bridge/cli": "^0.6.4",
66
60
  "@types/jest": "^30.0.0",
61
+ "@typescript/native": "npm:typescript@^7.0.2",
67
62
  "deepmerge": "^4.2.2",
68
63
  "jest": "^30.4.2",
69
64
  "nock": "^13.3.1",
65
+ "rimraf": "^5.0.5",
70
66
  "ts-jest": "^29.4.11",
71
67
  "tsx": "^4.20.5",
72
68
  "typedoc": "^0.25.13",
73
69
  "typedoc-plugin-missing-exports": "^2.0.0",
74
- "typescript": "~5.3.3"
70
+ "typescript": "npm:@typescript/typescript6@^6.0.2"
75
71
  },
76
72
  "engines": {
77
- "node": "^18.18 || >=20"
73
+ "node": "^22.14.0 || ^24"
78
74
  }
79
75
  }
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file is auto generated.
4
- * Do not edit manually.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=chomp-api-service-method-action-types.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chomp-api-service-method-action-types.cjs","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 to\n * decide whether an association already exists, so it is always fetched\n * fresh (`staleTime: 0`, `cacheTime: 0`) and the query key is scoped to the\n * profile via a digest of the bearer token — concurrent calls only share a\n * request when they are for the same profile.\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 * @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,133 +0,0 @@
1
- /**
2
- * This file is auto generated.
3
- * Do not edit manually.
4
- */
5
- import type { ChompApiService } from "./chomp-api-service.cjs";
6
- /**
7
- * Associates an address with a CHOMP profile.
8
- *
9
- * POST /v1/auth/address
10
- *
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.
17
- */
18
- export type ChompApiServiceAssociateAddressAction = {
19
- type: `ChompApiService:associateAddress`;
20
- handler: ChompApiService['associateAddress'];
21
- };
22
- /**
23
- * Fetches the addresses associated with the authenticated profile.
24
- *
25
- * GET /v1/auth/address
26
- *
27
- * The result is scoped to the authenticated profile and consumers use it to
28
- * decide whether an association already exists, so it is always fetched
29
- * fresh (`staleTime: 0`, `cacheTime: 0`) and the query key is scoped to the
30
- * profile via a digest of the bearer token — concurrent calls only share a
31
- * request when they are for the same profile.
32
- *
33
- * @returns The active address associations; empty array if none exist.
34
- * Addresses are lowercased.
35
- */
36
- export type ChompApiServiceGetAssociatedAddressesAction = {
37
- type: `ChompApiService:getAssociatedAddresses`;
38
- handler: ChompApiService['getAssociatedAddresses'];
39
- };
40
- /**
41
- * Creates an account upgrade request.
42
- *
43
- * POST /v1/account-upgrade
44
- *
45
- * @param params - The upgrade params containing signature components and
46
- * chain details.
47
- * @returns The upgrade result.
48
- */
49
- export type ChompApiServiceCreateUpgradeAction = {
50
- type: `ChompApiService:createUpgrade`;
51
- handler: ChompApiService['createUpgrade'];
52
- };
53
- /**
54
- * Fetches all EIP-7702 upgrade authorizations for a given address (one per
55
- * chain).
56
- *
57
- * GET /v1/account-upgrade/:address
58
- *
59
- * @param address - The address to look up.
60
- * @returns The upgrade entries; empty array if none exist.
61
- */
62
- export type ChompApiServiceGetUpgradesAction = {
63
- type: `ChompApiService:getUpgrades`;
64
- handler: ChompApiService['getUpgrades'];
65
- };
66
- /**
67
- * Verifies a delegation signature.
68
- *
69
- * POST /v1/intent/verify-delegation
70
- *
71
- * @param params - The delegation verification params.
72
- * @returns The verification result including validity and optional errors.
73
- */
74
- export type ChompApiServiceVerifyDelegationAction = {
75
- type: `ChompApiService:verifyDelegation`;
76
- handler: ChompApiService['verifyDelegation'];
77
- };
78
- /**
79
- * Submits one or more intents to the CHOMP API.
80
- *
81
- * POST /v1/intent
82
- *
83
- * @param intents - The array of intents to submit.
84
- * @returns The array of intent responses.
85
- */
86
- export type ChompApiServiceCreateIntentsAction = {
87
- type: `ChompApiService:createIntents`;
88
- handler: ChompApiService['createIntents'];
89
- };
90
- /**
91
- * Fetches intents associated with a given address.
92
- *
93
- * GET /v1/intent/account/:address
94
- *
95
- * @param address - The address to look up intents for.
96
- * @returns The array of intents for the address.
97
- */
98
- export type ChompApiServiceGetIntentsByAddressAction = {
99
- type: `ChompApiService:getIntentsByAddress`;
100
- handler: ChompApiService['getIntentsByAddress'];
101
- };
102
- /**
103
- * Creates a withdrawal for card spend flows.
104
- *
105
- * POST /v1/withdrawal
106
- *
107
- * @param params - The withdrawal params containing chainId, amount
108
- * (decimal or hex string), and account address.
109
- * @returns The withdrawal result.
110
- */
111
- export type ChompApiServiceCreateWithdrawalAction = {
112
- type: `ChompApiService:createWithdrawal`;
113
- handler: ChompApiService['createWithdrawal'];
114
- };
115
- /**
116
- * Retrieves service details including delegation redeemer addresses and DeFi
117
- * contract details for signing delegations for auto-deposit functionality.
118
- *
119
- * GET /v1/chomp
120
- *
121
- * @param chainIds - Array of chain IDs (0x-prefixed hex strings) to retrieve
122
- * details for.
123
- * @returns The service details for the requested chains.
124
- */
125
- export type ChompApiServiceGetServiceDetailsAction = {
126
- type: `ChompApiService:getServiceDetails`;
127
- handler: ChompApiService['getServiceDetails'];
128
- };
129
- /**
130
- * Union of all ChompApiService action types.
131
- */
132
- export type ChompApiServiceMethodActions = ChompApiServiceAssociateAddressAction | ChompApiServiceGetAssociatedAddressesAction | ChompApiServiceCreateUpgradeAction | ChompApiServiceGetUpgradesAction | ChompApiServiceVerifyDelegationAction | ChompApiServiceCreateIntentsAction | ChompApiServiceGetIntentsByAddressAction | ChompApiServiceCreateWithdrawalAction | ChompApiServiceGetServiceDetailsAction;
133
- //# sourceMappingURL=chomp-api-service-method-action-types.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chomp-api-service-method-action-types.d.cts","sourceRoot":"","sources":["../src/chomp-api-service-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,gCAA+B;AAE9D;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD,IAAI,EAAE,kCAAkC,CAAC;IACzC,OAAO,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;CAC9C,CAAC;AAEF;;;;;;;;;;;;;GAaG;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;;;;;;;GAOG;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 +0,0 @@
1
- {"version":3,"file":"chomp-api-service-method-action-types.d.mts","sourceRoot":"","sources":["../src/chomp-api-service-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,gCAA+B;AAE9D;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,qCAA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AAO,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 +0,0 @@
1
- {"version":3,"file":"chomp-api-service-method-action-types.mjs","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 to\n * decide whether an association already exists, so it is always fetched\n * fresh (`staleTime: 0`, `cacheTime: 0`) and the query key is scoped to the\n * profile via a digest of the bearer token — concurrent calls only share a\n * request when they are for the same profile.\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 * @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"]}