@metamask-previews/money-account-api-data-service 2.3.1-preview-c33f4af3a → 2.3.1-preview-e1e83cae0

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 CHANGED
@@ -7,6 +7,10 @@ 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 `fetchVaultShareValuations`, which reads `GET /v1/positions/:address/vault-share-valuations` for up to 50 transaction hashes and is exposed as the `MoneyAccountApiDataService:fetchVaultShareValuations` action. Export `VaultShareValuationsResponse`, `VaultShareValuation`, `VaultShareValuationResult`, `VaultShareValuationsOptions`, `VAULT_SHARE_VALUATIONS_MAX_TX_HASHES`, and `MoneyAccountApiDataServiceFetchVaultShareValuationsAction` ([#11433](https://github.com/MetaMask/core/pull/11433))
13
+
10
14
  ## [2.3.1]
11
15
 
12
16
  ### Changed
package/README.md CHANGED
@@ -19,6 +19,7 @@ This package exports a `MoneyAccountApiDataService` class that exposes the follo
19
19
  - **`fetchHistory`** — Fetch cursor-paginated cash-flow history.
20
20
  - **`fetchRateHistory`** — Fetch vault exchange-rate time series.
21
21
  - **`fetchVaultRate`** — Fetch a vault's current exchange rate.
22
+ - **`fetchVaultShareValuations`** — Batch-value vault share movements in past transactions, up to 50 hashes per request.
22
23
 
23
24
  See the [main `MoneyAccountApiDataService` source](./src/money-account-api-data-service.ts) for full API details.
24
25
 
@@ -54,4 +54,20 @@ export declare const MONEY_ACCOUNT_SIWE_CHALLENGE_TTL_MS = 300000;
54
54
  * still rejects future-dated challenges on its own clock.
55
55
  */
56
56
  export declare const MONEY_ACCOUNT_SIWE_CLOCK_SKEW_MS = 60000;
57
+ /**
58
+ * Maximum number of distinct transaction hashes the Money Account API accepts
59
+ * per vault share valuations request.
60
+ */
61
+ export declare const VAULT_SHARE_VALUATIONS_MAX_TX_HASHES = 50;
62
+ /**
63
+ * Stale time (ms) for a vault share valuations batch where every requested
64
+ * transaction is indexed. Matches the API's `private, max-age=86400`.
65
+ */
66
+ export declare const VAULT_SHARE_VALUATIONS_COMPLETE_STALE_TIME_MS = 86400000;
67
+ /**
68
+ * Stale time (ms) for a batch with any missing transaction, which may only mean
69
+ * the transaction is newer than the indexer cursor. Matches the API's
70
+ * `private, max-age=30`.
71
+ */
72
+ export declare const VAULT_SHARE_VALUATIONS_PARTIAL_STALE_TIME_MS = 30000;
57
73
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,GAAG;IACb,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CAIzD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,0BAA0B,SAAU,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,wBAAwB,SAAU,CAAC;AAEhD;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,wCACF,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC,SAAU,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,QAAS,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,GAAG;IACb,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CAIzD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,0BAA0B,SAAU,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,wBAAwB,SAAU,CAAC;AAEhD;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,wCACF,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC,SAAU,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,QAAS,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,oCAAoC,KAAK,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,6CAA6C,WAAa,CAAC;AAExE;;;;GAIG;AACH,eAAO,MAAM,4CAA4C,QAAS,CAAC"}
package/dist/constants.js CHANGED
@@ -59,4 +59,20 @@ export const MONEY_ACCOUNT_SIWE_CHALLENGE_TTL_MS = 300_000;
59
59
  * still rejects future-dated challenges on its own clock.
60
60
  */
61
61
  export const MONEY_ACCOUNT_SIWE_CLOCK_SKEW_MS = 60_000;
62
+ /**
63
+ * Maximum number of distinct transaction hashes the Money Account API accepts
64
+ * per vault share valuations request.
65
+ */
66
+ export const VAULT_SHARE_VALUATIONS_MAX_TX_HASHES = 50;
67
+ /**
68
+ * Stale time (ms) for a vault share valuations batch where every requested
69
+ * transaction is indexed. Matches the API's `private, max-age=86400`.
70
+ */
71
+ export const VAULT_SHARE_VALUATIONS_COMPLETE_STALE_TIME_MS = 86_400_000;
72
+ /**
73
+ * Stale time (ms) for a batch with any missing transaction, which may only mean
74
+ * the transaction is newer than the indexer cursor. Matches the API's
75
+ * `private, max-age=30`.
76
+ */
77
+ export const VAULT_SHARE_VALUATIONS_PARTIAL_STALE_TIME_MS = 30_000;
62
78
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,GAIX;AAJD,WAAY,GAAG;IACb,kBAAW,CAAA;IACX,kBAAW,CAAA;IACX,kBAAW,CAAA;AACb,CAAC,EAJW,GAAG,KAAH,GAAG,QAId;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAwB;IAC5D,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,sCAAsC;IACjD,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,sCAAsC;IACjD,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,kCAAkC;CAC9C,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,OAAO,CAAC;AAElD;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAO,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,4BAA4B,GACvC,qCAAqC,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,OAAO,CAAC;AAE3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,MAAM,CAAC","sourcesContent":["/**\n * Supported environments for the Money Account APY Tracking API.\n */\nexport enum Env {\n DEV = 'dev',\n UAT = 'uat',\n PRD = 'prd',\n}\n\n/**\n * Base URL map for the Money Account APY Tracking API, keyed by environment.\n */\nexport const MONEY_ACCOUNT_API_URL_MAP: Record<Env, string> = {\n [Env.DEV]: 'https://money.dev-api.cx.metamask.io',\n [Env.UAT]: 'https://money.uat-api.cx.metamask.io',\n [Env.PRD]: 'https://money.api.cx.metamask.io',\n};\n\n/**\n * Default stale time (ms) for position/interest/history queries.\n * Matches the server-side cache TTL of 30 seconds.\n */\nexport const DEFAULT_STALE_TIME_MS = 30_000;\n\n/**\n * Default stale time (ms) for rate-history queries.\n * Matches the server-side cache TTL of 5 minutes.\n */\nexport const RATE_HISTORY_STALE_TIME_MS = 300_000;\n\n/**\n * Default stale time (ms) for current vault rate queries.\n * Matches the server-side cache TTL of 5 minutes.\n */\nexport const VAULT_RATE_STALE_TIME_MS = 300_000;\n\n/**\n * Statement embedded in every Money Account VBA SIWE challenge.\n *\n * Pinned to the Money Account API's SIWE template\n * (`buildSiweMessage` in `vba-siwe.service.ts`). Changing it on the API\n * requires a matching client release, otherwise every challenge is rejected.\n */\nexport const MONEY_ACCOUNT_SIWE_STATEMENT =\n 'Sign in to view your VBA transfers.';\n\n/**\n * Chain ID every Money Account VBA SIWE challenge is bound to (Monad).\n *\n * Pinned to the Money Account API's SIWE template, which resolves this chain\n * ID for the `test-monad`, `uat`, and `production` deployments. Changing it on\n * the API requires a matching client release.\n */\nexport const MONEY_ACCOUNT_SIWE_CHAIN_ID = 143;\n\n/**\n * Validity window (ms) encoded in every Money Account VBA SIWE challenge.\n *\n * Mirrors `NONCE_TTL_SECONDS` in the Money Account API's SIWE service. Changing\n * it on the API requires a matching client release.\n */\nexport const MONEY_ACCOUNT_SIWE_CHALLENGE_TTL_MS = 300_000;\n\n/**\n * Clock skew (ms) tolerated when checking that a challenge's `Issued At` is not\n * in the future. This is a client-side tolerance only; the Money Account API\n * still rejects future-dated challenges on its own clock.\n */\nexport const MONEY_ACCOUNT_SIWE_CLOCK_SKEW_MS = 60_000;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,GAIX;AAJD,WAAY,GAAG;IACb,kBAAW,CAAA;IACX,kBAAW,CAAA;IACX,kBAAW,CAAA;AACb,CAAC,EAJW,GAAG,KAAH,GAAG,QAId;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAwB;IAC5D,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,sCAAsC;IACjD,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,sCAAsC;IACjD,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,kCAAkC;CAC9C,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,OAAO,CAAC;AAElD;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAO,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,4BAA4B,GACvC,qCAAqC,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,OAAO,CAAC;AAE3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,MAAM,CAAC;AAEvD;;;GAGG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,EAAE,CAAC;AAEvD;;;GAGG;AACH,MAAM,CAAC,MAAM,6CAA6C,GAAG,UAAU,CAAC;AAExE;;;;GAIG;AACH,MAAM,CAAC,MAAM,4CAA4C,GAAG,MAAM,CAAC","sourcesContent":["/**\n * Supported environments for the Money Account APY Tracking API.\n */\nexport enum Env {\n DEV = 'dev',\n UAT = 'uat',\n PRD = 'prd',\n}\n\n/**\n * Base URL map for the Money Account APY Tracking API, keyed by environment.\n */\nexport const MONEY_ACCOUNT_API_URL_MAP: Record<Env, string> = {\n [Env.DEV]: 'https://money.dev-api.cx.metamask.io',\n [Env.UAT]: 'https://money.uat-api.cx.metamask.io',\n [Env.PRD]: 'https://money.api.cx.metamask.io',\n};\n\n/**\n * Default stale time (ms) for position/interest/history queries.\n * Matches the server-side cache TTL of 30 seconds.\n */\nexport const DEFAULT_STALE_TIME_MS = 30_000;\n\n/**\n * Default stale time (ms) for rate-history queries.\n * Matches the server-side cache TTL of 5 minutes.\n */\nexport const RATE_HISTORY_STALE_TIME_MS = 300_000;\n\n/**\n * Default stale time (ms) for current vault rate queries.\n * Matches the server-side cache TTL of 5 minutes.\n */\nexport const VAULT_RATE_STALE_TIME_MS = 300_000;\n\n/**\n * Statement embedded in every Money Account VBA SIWE challenge.\n *\n * Pinned to the Money Account API's SIWE template\n * (`buildSiweMessage` in `vba-siwe.service.ts`). Changing it on the API\n * requires a matching client release, otherwise every challenge is rejected.\n */\nexport const MONEY_ACCOUNT_SIWE_STATEMENT =\n 'Sign in to view your VBA transfers.';\n\n/**\n * Chain ID every Money Account VBA SIWE challenge is bound to (Monad).\n *\n * Pinned to the Money Account API's SIWE template, which resolves this chain\n * ID for the `test-monad`, `uat`, and `production` deployments. Changing it on\n * the API requires a matching client release.\n */\nexport const MONEY_ACCOUNT_SIWE_CHAIN_ID = 143;\n\n/**\n * Validity window (ms) encoded in every Money Account VBA SIWE challenge.\n *\n * Mirrors `NONCE_TTL_SECONDS` in the Money Account API's SIWE service. Changing\n * it on the API requires a matching client release.\n */\nexport const MONEY_ACCOUNT_SIWE_CHALLENGE_TTL_MS = 300_000;\n\n/**\n * Clock skew (ms) tolerated when checking that a challenge's `Issued At` is not\n * in the future. This is a client-side tolerance only; the Money Account API\n * still rejects future-dated challenges on its own clock.\n */\nexport const MONEY_ACCOUNT_SIWE_CLOCK_SKEW_MS = 60_000;\n\n/**\n * Maximum number of distinct transaction hashes the Money Account API accepts\n * per vault share valuations request.\n */\nexport const VAULT_SHARE_VALUATIONS_MAX_TX_HASHES = 50;\n\n/**\n * Stale time (ms) for a vault share valuations batch where every requested\n * transaction is indexed. Matches the API's `private, max-age=86400`.\n */\nexport const VAULT_SHARE_VALUATIONS_COMPLETE_STALE_TIME_MS = 86_400_000;\n\n/**\n * Stale time (ms) for a batch with any missing transaction, which may only mean\n * the transaction is newer than the indexer cursor. Matches the API's\n * `private, max-age=30`.\n */\nexport const VAULT_SHARE_VALUATIONS_PARTIAL_STALE_TIME_MS = 30_000;\n"]}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export { MoneyAccountApiDataService } from './money-account-api-data-service.js';
2
2
  export type { MoneyAccountApiDataServiceActions, MoneyAccountApiDataServiceEvents, MoneyAccountApiDataServiceMessenger, MoneyAccountApiDataServiceOptions, MoneyAccountApiDataServiceTraceCallback, MoneyAccountApiDataServiceTraceRequest, } from './money-account-api-data-service.js';
3
- export type { MoneyAccountApiDataServiceFetchPositionsAction, MoneyAccountApiDataServiceFetchInterestAction, MoneyAccountApiDataServiceFetchHistoryAction, MoneyAccountApiDataServiceFetchRateHistoryAction, MoneyAccountApiDataServiceFetchVaultRateAction, MoneyAccountApiDataServiceFetchVbaTransfersAction, } from './money-account-api-data-service-method-action-types.js';
4
- export type { PositionResponse, PositionBalance, AssetBalance, InterestResponse, HistoryResponse, RateHistoryResponse, VaultRateResponse, VbaSiweChallengeResponse, VbaSiweSessionResponse, VbaTransfer, VbaTransfersResponse, VaultPosition, CashFlowEntry, RateHistoryEntry, DataFreshness, CashFlowType, CashFlowSource, } from './response.types.js';
5
- export type { InterestWindow, InterestOptions, FetchPositionsOptions, HistoryOptions, RateHistoryOptions, VaultRateOptions, FetchVbaTransfersOptions, } from './types.js';
6
- export { Env } from './constants.js';
3
+ export type { MoneyAccountApiDataServiceFetchPositionsAction, MoneyAccountApiDataServiceFetchInterestAction, MoneyAccountApiDataServiceFetchHistoryAction, MoneyAccountApiDataServiceFetchRateHistoryAction, MoneyAccountApiDataServiceFetchVaultRateAction, MoneyAccountApiDataServiceFetchVaultShareValuationsAction, MoneyAccountApiDataServiceFetchVbaTransfersAction, } from './money-account-api-data-service-method-action-types.js';
4
+ export type { PositionResponse, PositionBalance, AssetBalance, InterestResponse, HistoryResponse, RateHistoryResponse, VaultRateResponse, VaultShareValuation, VaultShareValuationResult, VaultShareValuationsResponse, VbaSiweChallengeResponse, VbaSiweSessionResponse, VbaTransfer, VbaTransfersResponse, VaultPosition, CashFlowEntry, RateHistoryEntry, DataFreshness, CashFlowType, CashFlowSource, } from './response.types.js';
5
+ export type { InterestWindow, InterestOptions, FetchPositionsOptions, HistoryOptions, RateHistoryOptions, VaultRateOptions, VaultShareValuationsOptions, FetchVbaTransfersOptions, } from './types.js';
6
+ export { Env, VAULT_SHARE_VALUATIONS_MAX_TX_HASHES } from './constants.js';
7
7
  export { MoneyAccountApiHttpError, MoneyAccountApiResponseValidationError, } from './errors.js';
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,YAAY,EACV,iCAAiC,EACjC,gCAAgC,EAChC,mCAAmC,EACnC,iCAAiC,EACjC,uCAAuC,EACvC,sCAAsC,GACvC,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EACV,8CAA8C,EAC9C,6CAA6C,EAC7C,4CAA4C,EAC5C,gDAAgD,EAChD,8CAA8C,EAC9C,iDAAiD,GAClD,MAAM,yDAAyD,CAAC;AACjE,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,EACtB,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EACL,wBAAwB,EACxB,sCAAsC,GACvC,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,YAAY,EACV,iCAAiC,EACjC,gCAAgC,EAChC,mCAAmC,EACnC,iCAAiC,EACjC,uCAAuC,EACvC,sCAAsC,GACvC,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EACV,8CAA8C,EAC9C,6CAA6C,EAC7C,4CAA4C,EAC5C,gDAAgD,EAChD,8CAA8C,EAC9C,yDAAyD,EACzD,iDAAiD,GAClD,MAAM,yDAAyD,CAAC;AACjE,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EACzB,4BAA4B,EAC5B,wBAAwB,EACxB,sBAAsB,EACtB,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,GAAG,EAAE,oCAAoC,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EACL,wBAAwB,EACxB,sCAAsC,GACvC,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export { MoneyAccountApiDataService } from './money-account-api-data-service.js';
2
- export { Env } from './constants.js';
2
+ export { Env, VAULT_SHARE_VALUATIONS_MAX_TX_HASHES } from './constants.js';
3
3
  export { MoneyAccountApiHttpError, MoneyAccountApiResponseValidationError, } from './errors.js';
4
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AA6CjF,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EACL,wBAAwB,EACxB,sCAAsC,GACvC,MAAM,aAAa,CAAC","sourcesContent":["export { MoneyAccountApiDataService } from './money-account-api-data-service.js';\nexport type {\n MoneyAccountApiDataServiceActions,\n MoneyAccountApiDataServiceEvents,\n MoneyAccountApiDataServiceMessenger,\n MoneyAccountApiDataServiceOptions,\n MoneyAccountApiDataServiceTraceCallback,\n MoneyAccountApiDataServiceTraceRequest,\n} from './money-account-api-data-service.js';\nexport type {\n MoneyAccountApiDataServiceFetchPositionsAction,\n MoneyAccountApiDataServiceFetchInterestAction,\n MoneyAccountApiDataServiceFetchHistoryAction,\n MoneyAccountApiDataServiceFetchRateHistoryAction,\n MoneyAccountApiDataServiceFetchVaultRateAction,\n MoneyAccountApiDataServiceFetchVbaTransfersAction,\n} from './money-account-api-data-service-method-action-types.js';\nexport type {\n PositionResponse,\n PositionBalance,\n AssetBalance,\n InterestResponse,\n HistoryResponse,\n RateHistoryResponse,\n VaultRateResponse,\n VbaSiweChallengeResponse,\n VbaSiweSessionResponse,\n VbaTransfer,\n VbaTransfersResponse,\n VaultPosition,\n CashFlowEntry,\n RateHistoryEntry,\n DataFreshness,\n CashFlowType,\n CashFlowSource,\n} from './response.types.js';\nexport type {\n InterestWindow,\n InterestOptions,\n FetchPositionsOptions,\n HistoryOptions,\n RateHistoryOptions,\n VaultRateOptions,\n FetchVbaTransfersOptions,\n} from './types.js';\nexport { Env } from './constants.js';\nexport {\n MoneyAccountApiHttpError,\n MoneyAccountApiResponseValidationError,\n} from './errors.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAkDjF,OAAO,EAAE,GAAG,EAAE,oCAAoC,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EACL,wBAAwB,EACxB,sCAAsC,GACvC,MAAM,aAAa,CAAC","sourcesContent":["export { MoneyAccountApiDataService } from './money-account-api-data-service.js';\nexport type {\n MoneyAccountApiDataServiceActions,\n MoneyAccountApiDataServiceEvents,\n MoneyAccountApiDataServiceMessenger,\n MoneyAccountApiDataServiceOptions,\n MoneyAccountApiDataServiceTraceCallback,\n MoneyAccountApiDataServiceTraceRequest,\n} from './money-account-api-data-service.js';\nexport type {\n MoneyAccountApiDataServiceFetchPositionsAction,\n MoneyAccountApiDataServiceFetchInterestAction,\n MoneyAccountApiDataServiceFetchHistoryAction,\n MoneyAccountApiDataServiceFetchRateHistoryAction,\n MoneyAccountApiDataServiceFetchVaultRateAction,\n MoneyAccountApiDataServiceFetchVaultShareValuationsAction,\n MoneyAccountApiDataServiceFetchVbaTransfersAction,\n} from './money-account-api-data-service-method-action-types.js';\nexport type {\n PositionResponse,\n PositionBalance,\n AssetBalance,\n InterestResponse,\n HistoryResponse,\n RateHistoryResponse,\n VaultRateResponse,\n VaultShareValuation,\n VaultShareValuationResult,\n VaultShareValuationsResponse,\n VbaSiweChallengeResponse,\n VbaSiweSessionResponse,\n VbaTransfer,\n VbaTransfersResponse,\n VaultPosition,\n CashFlowEntry,\n RateHistoryEntry,\n DataFreshness,\n CashFlowType,\n CashFlowSource,\n} from './response.types.js';\nexport type {\n InterestWindow,\n InterestOptions,\n FetchPositionsOptions,\n HistoryOptions,\n RateHistoryOptions,\n VaultRateOptions,\n VaultShareValuationsOptions,\n FetchVbaTransfersOptions,\n} from './types.js';\nexport { Env, VAULT_SHARE_VALUATIONS_MAX_TX_HASHES } from './constants.js';\nexport {\n MoneyAccountApiHttpError,\n MoneyAccountApiResponseValidationError,\n} from './errors.js';\n"]}
@@ -72,6 +72,26 @@ export type MoneyAccountApiDataServiceFetchVaultRateAction = {
72
72
  type: `MoneyAccountApiDataService:fetchVaultRate`;
73
73
  handler: MoneyAccountApiDataService['fetchVaultRate'];
74
74
  };
75
+ /**
76
+ * Batch-values vault share movements in past transactions. Each result
77
+ * reports the shares moved and what they were worth in the vault's
78
+ * underlying asset at that block. Unknown transactions come back with
79
+ * `found: false` instead of failing the batch.
80
+ *
81
+ * @param address - The user's Ethereum address.
82
+ * @param options - Transaction hashes to value and an optional chain ID.
83
+ * @param options.txHashes - Transaction hashes. At most 50 distinct hashes
84
+ * after lowercasing and de-duplication.
85
+ * @param options.chainId - Chain ID of the transactions. Omitted requests use
86
+ * the API default (Monad, 143).
87
+ * @returns One result per requested hash, in request order.
88
+ * @throws An `Error` before any request when `txHashes` is empty or contains
89
+ * more than 50 distinct hashes.
90
+ */
91
+ export type MoneyAccountApiDataServiceFetchVaultShareValuationsAction = {
92
+ type: `MoneyAccountApiDataService:fetchVaultShareValuations`;
93
+ handler: MoneyAccountApiDataService['fetchVaultShareValuations'];
94
+ };
75
95
  /**
76
96
  * Fetches current VBA transfers for the wallet authenticated via SIWE.
77
97
  *
@@ -85,5 +105,5 @@ export type MoneyAccountApiDataServiceFetchVbaTransfersAction = {
85
105
  /**
86
106
  * Union of all MoneyAccountApiDataService action types.
87
107
  */
88
- export type MoneyAccountApiDataServiceMethodActions = MoneyAccountApiDataServiceFetchPositionsAction | MoneyAccountApiDataServiceFetchInterestAction | MoneyAccountApiDataServiceFetchHistoryAction | MoneyAccountApiDataServiceFetchRateHistoryAction | MoneyAccountApiDataServiceFetchVaultRateAction | MoneyAccountApiDataServiceFetchVbaTransfersAction;
108
+ export type MoneyAccountApiDataServiceMethodActions = MoneyAccountApiDataServiceFetchPositionsAction | MoneyAccountApiDataServiceFetchInterestAction | MoneyAccountApiDataServiceFetchHistoryAction | MoneyAccountApiDataServiceFetchRateHistoryAction | MoneyAccountApiDataServiceFetchVaultRateAction | MoneyAccountApiDataServiceFetchVaultShareValuationsAction | MoneyAccountApiDataServiceFetchVbaTransfersAction;
89
109
  //# sourceMappingURL=money-account-api-data-service-method-action-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"money-account-api-data-service-method-action-types.d.ts","sourceRoot":"","sources":["../src/money-account-api-data-service-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEtF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,0BAA0B,CAAC,gBAAgB,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,0BAA0B,CAAC,eAAe,CAAC,CAAC;CACtD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,0BAA0B,CAAC,cAAc,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,gDAAgD,GAAG;IAC7D,IAAI,EAAE,6CAA6C,CAAC;IACpD,OAAO,EAAE,0BAA0B,CAAC,kBAAkB,CAAC,CAAC;CACzD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,0BAA0B,CAAC,gBAAgB,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iDAAiD,GAAG;IAC9D,IAAI,EAAE,8CAA8C,CAAC;IACrD,OAAO,EAAE,0BAA0B,CAAC,mBAAmB,CAAC,CAAC;CAC1D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uCAAuC,GAC/C,8CAA8C,GAC9C,6CAA6C,GAC7C,4CAA4C,GAC5C,gDAAgD,GAChD,8CAA8C,GAC9C,iDAAiD,CAAC"}
1
+ {"version":3,"file":"money-account-api-data-service-method-action-types.d.ts","sourceRoot":"","sources":["../src/money-account-api-data-service-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEtF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,0BAA0B,CAAC,gBAAgB,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,0BAA0B,CAAC,eAAe,CAAC,CAAC;CACtD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,0BAA0B,CAAC,cAAc,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,gDAAgD,GAAG;IAC7D,IAAI,EAAE,6CAA6C,CAAC;IACpD,OAAO,EAAE,0BAA0B,CAAC,kBAAkB,CAAC,CAAC;CACzD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,0BAA0B,CAAC,gBAAgB,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,sDAAsD,CAAC;IAC7D,OAAO,EAAE,0BAA0B,CAAC,2BAA2B,CAAC,CAAC;CAClE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iDAAiD,GAAG;IAC9D,IAAI,EAAE,8CAA8C,CAAC;IACrD,OAAO,EAAE,0BAA0B,CAAC,mBAAmB,CAAC,CAAC;CAC1D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uCAAuC,GAC/C,8CAA8C,GAC9C,6CAA6C,GAC7C,4CAA4C,GAC5C,gDAAgD,GAChD,8CAA8C,GAC9C,yDAAyD,GACzD,iDAAiD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"money-account-api-data-service-method-action-types.js","sourceRoot":"","sources":["../src/money-account-api-data-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 { MoneyAccountApiDataService } from './money-account-api-data-service.js';\n\n/**\n * Fetches the current vault positions for a given user address.\n *\n * @param address - The user's Ethereum address.\n * @param options - Optional fetch options.\n * @param options.fresh - When true, cancels in-flight reads, fetches with a\n * zero stale time, invalidates the result for subsequent reads, and asks the\n * Money API to skip its Nest response cache with `Cache-Control: no-cache`.\n * @returns The position response containing vault positions and an optional\n * `balance` summary (`null` when the API balance path is unavailable).\n */\nexport type MoneyAccountApiDataServiceFetchPositionsAction = {\n type: `MoneyAccountApiDataService:fetchPositions`;\n handler: MoneyAccountApiDataService['fetchPositions'];\n};\n\n/**\n * Fetches the interest earned for a given address and vault over a\n * specified time window.\n *\n * @param address - The user's Ethereum address.\n * @param options - Options specifying vault, window, and optional chain ID.\n * @returns The interest response.\n */\nexport type MoneyAccountApiDataServiceFetchInterestAction = {\n type: `MoneyAccountApiDataService:fetchInterest`;\n handler: MoneyAccountApiDataService['fetchInterest'];\n};\n\n/**\n * Fetches cursor-paginated cash-flow history for a given address.\n * Uses `fetchInfiniteQuery` for proper TanStack Query pagination semantics.\n *\n * When paginating, consumers must re-pass the same filter options\n * (`vaultAddress`, `chainId`, `limit`) alongside `cursor` on every page\n * request. This ensures the query key matches the original infinite query\n * and that the HTTP request includes the correct filters.\n *\n * @param address - The user's Ethereum address.\n * @param options - Optional filtering and pagination options.\n * @returns The history response containing cash-flow entries for the requested page.\n */\nexport type MoneyAccountApiDataServiceFetchHistoryAction = {\n type: `MoneyAccountApiDataService:fetchHistory`;\n handler: MoneyAccountApiDataService['fetchHistory'];\n};\n\n/**\n * Fetches the exchange-rate time series for a given vault.\n *\n * @param vaultAddress - The vault's Ethereum address.\n * @param options - Optional range and chain ID filters.\n * @returns The rate history response.\n */\nexport type MoneyAccountApiDataServiceFetchRateHistoryAction = {\n type: `MoneyAccountApiDataService:fetchRateHistory`;\n handler: MoneyAccountApiDataService['fetchRateHistory'];\n};\n\n/**\n * Fetches the current Accountant exchange rate for a vault.\n *\n * The server returns 404 when the vault is not in the deployment registry\n * or has no indexed rate yet.\n *\n * @param vaultAddress - The vault's Ethereum address.\n * @param options - Optional chain ID filter. Omitted requests use the API default.\n * @returns The current vault rate response.\n */\nexport type MoneyAccountApiDataServiceFetchVaultRateAction = {\n type: `MoneyAccountApiDataService:fetchVaultRate`;\n handler: MoneyAccountApiDataService['fetchVaultRate'];\n};\n\n/**\n * Fetches current VBA transfers for the wallet authenticated via SIWE.\n *\n * @param options - Fetch options, including the wallet address to authenticate.\n * @returns Current transfers belonging to the authenticated wallet.\n */\nexport type MoneyAccountApiDataServiceFetchVbaTransfersAction = {\n type: `MoneyAccountApiDataService:fetchVbaTransfers`;\n handler: MoneyAccountApiDataService['fetchVbaTransfers'];\n};\n\n/**\n * Union of all MoneyAccountApiDataService action types.\n */\nexport type MoneyAccountApiDataServiceMethodActions =\n | MoneyAccountApiDataServiceFetchPositionsAction\n | MoneyAccountApiDataServiceFetchInterestAction\n | MoneyAccountApiDataServiceFetchHistoryAction\n | MoneyAccountApiDataServiceFetchRateHistoryAction\n | MoneyAccountApiDataServiceFetchVaultRateAction\n | MoneyAccountApiDataServiceFetchVbaTransfersAction;\n"]}
1
+ {"version":3,"file":"money-account-api-data-service-method-action-types.js","sourceRoot":"","sources":["../src/money-account-api-data-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 { MoneyAccountApiDataService } from './money-account-api-data-service.js';\n\n/**\n * Fetches the current vault positions for a given user address.\n *\n * @param address - The user's Ethereum address.\n * @param options - Optional fetch options.\n * @param options.fresh - When true, cancels in-flight reads, fetches with a\n * zero stale time, invalidates the result for subsequent reads, and asks the\n * Money API to skip its Nest response cache with `Cache-Control: no-cache`.\n * @returns The position response containing vault positions and an optional\n * `balance` summary (`null` when the API balance path is unavailable).\n */\nexport type MoneyAccountApiDataServiceFetchPositionsAction = {\n type: `MoneyAccountApiDataService:fetchPositions`;\n handler: MoneyAccountApiDataService['fetchPositions'];\n};\n\n/**\n * Fetches the interest earned for a given address and vault over a\n * specified time window.\n *\n * @param address - The user's Ethereum address.\n * @param options - Options specifying vault, window, and optional chain ID.\n * @returns The interest response.\n */\nexport type MoneyAccountApiDataServiceFetchInterestAction = {\n type: `MoneyAccountApiDataService:fetchInterest`;\n handler: MoneyAccountApiDataService['fetchInterest'];\n};\n\n/**\n * Fetches cursor-paginated cash-flow history for a given address.\n * Uses `fetchInfiniteQuery` for proper TanStack Query pagination semantics.\n *\n * When paginating, consumers must re-pass the same filter options\n * (`vaultAddress`, `chainId`, `limit`) alongside `cursor` on every page\n * request. This ensures the query key matches the original infinite query\n * and that the HTTP request includes the correct filters.\n *\n * @param address - The user's Ethereum address.\n * @param options - Optional filtering and pagination options.\n * @returns The history response containing cash-flow entries for the requested page.\n */\nexport type MoneyAccountApiDataServiceFetchHistoryAction = {\n type: `MoneyAccountApiDataService:fetchHistory`;\n handler: MoneyAccountApiDataService['fetchHistory'];\n};\n\n/**\n * Fetches the exchange-rate time series for a given vault.\n *\n * @param vaultAddress - The vault's Ethereum address.\n * @param options - Optional range and chain ID filters.\n * @returns The rate history response.\n */\nexport type MoneyAccountApiDataServiceFetchRateHistoryAction = {\n type: `MoneyAccountApiDataService:fetchRateHistory`;\n handler: MoneyAccountApiDataService['fetchRateHistory'];\n};\n\n/**\n * Fetches the current Accountant exchange rate for a vault.\n *\n * The server returns 404 when the vault is not in the deployment registry\n * or has no indexed rate yet.\n *\n * @param vaultAddress - The vault's Ethereum address.\n * @param options - Optional chain ID filter. Omitted requests use the API default.\n * @returns The current vault rate response.\n */\nexport type MoneyAccountApiDataServiceFetchVaultRateAction = {\n type: `MoneyAccountApiDataService:fetchVaultRate`;\n handler: MoneyAccountApiDataService['fetchVaultRate'];\n};\n\n/**\n * Batch-values vault share movements in past transactions. Each result\n * reports the shares moved and what they were worth in the vault's\n * underlying asset at that block. Unknown transactions come back with\n * `found: false` instead of failing the batch.\n *\n * @param address - The user's Ethereum address.\n * @param options - Transaction hashes to value and an optional chain ID.\n * @param options.txHashes - Transaction hashes. At most 50 distinct hashes\n * after lowercasing and de-duplication.\n * @param options.chainId - Chain ID of the transactions. Omitted requests use\n * the API default (Monad, 143).\n * @returns One result per requested hash, in request order.\n * @throws An `Error` before any request when `txHashes` is empty or contains\n * more than 50 distinct hashes.\n */\nexport type MoneyAccountApiDataServiceFetchVaultShareValuationsAction = {\n type: `MoneyAccountApiDataService:fetchVaultShareValuations`;\n handler: MoneyAccountApiDataService['fetchVaultShareValuations'];\n};\n\n/**\n * Fetches current VBA transfers for the wallet authenticated via SIWE.\n *\n * @param options - Fetch options, including the wallet address to authenticate.\n * @returns Current transfers belonging to the authenticated wallet.\n */\nexport type MoneyAccountApiDataServiceFetchVbaTransfersAction = {\n type: `MoneyAccountApiDataService:fetchVbaTransfers`;\n handler: MoneyAccountApiDataService['fetchVbaTransfers'];\n};\n\n/**\n * Union of all MoneyAccountApiDataService action types.\n */\nexport type MoneyAccountApiDataServiceMethodActions =\n | MoneyAccountApiDataServiceFetchPositionsAction\n | MoneyAccountApiDataServiceFetchInterestAction\n | MoneyAccountApiDataServiceFetchHistoryAction\n | MoneyAccountApiDataServiceFetchRateHistoryAction\n | MoneyAccountApiDataServiceFetchVaultRateAction\n | MoneyAccountApiDataServiceFetchVaultShareValuationsAction\n | MoneyAccountApiDataServiceFetchVbaTransfersAction;\n"]}
@@ -5,8 +5,8 @@ import type { Messenger } from '@metamask/messenger';
5
5
  import type { QueryClientConfig } from '@tanstack/query-core';
6
6
  import { Env } from './constants.js';
7
7
  import type { MoneyAccountApiDataServiceMethodActions } from './money-account-api-data-service-method-action-types.js';
8
- import type { HistoryResponse, InterestResponse, PositionResponse, RateHistoryResponse, VaultRateResponse, VbaTransfersResponse } from './response.types.js';
9
- import type { HistoryOptions, InterestOptions, RateHistoryOptions, FetchPositionsOptions, VaultRateOptions, FetchVbaTransfersOptions } from './types.js';
8
+ import type { HistoryResponse, InterestResponse, PositionResponse, RateHistoryResponse, VaultRateResponse, VaultShareValuationsResponse, VbaTransfersResponse } from './response.types.js';
9
+ import type { HistoryOptions, InterestOptions, RateHistoryOptions, FetchPositionsOptions, VaultRateOptions, VaultShareValuationsOptions, FetchVbaTransfersOptions } from './types.js';
10
10
  /**
11
11
  * The name of the {@link MoneyAccountApiDataService}, used to namespace the
12
12
  * service's actions and events.
@@ -18,6 +18,7 @@ export declare const TRACES: {
18
18
  readonly HISTORY_API: 'Money Account API Fetch History';
19
19
  readonly RATE_HISTORY_API: 'Money Account API Fetch Rate History';
20
20
  readonly VAULT_RATE_API: 'Money Account API Fetch Vault Rate';
21
+ readonly VAULT_SHARE_VALUATIONS_API: 'Money Account API Fetch Vault Share Valuations';
21
22
  };
22
23
  export type MoneyAccountApiDataServiceTraceName = (typeof TRACES)[keyof typeof TRACES];
23
24
  export type MoneyAccountApiDataServiceTraceRequest = Omit<TraceRequest, 'name'> & {
@@ -151,6 +152,23 @@ export declare class MoneyAccountApiDataService extends BaseDataService<typeof s
151
152
  * @returns The current vault rate response.
152
153
  */
153
154
  fetchVaultRate(vaultAddress: string, options?: VaultRateOptions): Promise<VaultRateResponse>;
155
+ /**
156
+ * Batch-values vault share movements in past transactions. Each result
157
+ * reports the shares moved and what they were worth in the vault's
158
+ * underlying asset at that block. Unknown transactions come back with
159
+ * `found: false` instead of failing the batch.
160
+ *
161
+ * @param address - The user's Ethereum address.
162
+ * @param options - Transaction hashes to value and an optional chain ID.
163
+ * @param options.txHashes - Transaction hashes. At most 50 distinct hashes
164
+ * after lowercasing and de-duplication.
165
+ * @param options.chainId - Chain ID of the transactions. Omitted requests use
166
+ * the API default (Monad, 143).
167
+ * @returns One result per requested hash, in request order.
168
+ * @throws An `Error` before any request when `txHashes` is empty or contains
169
+ * more than 50 distinct hashes.
170
+ */
171
+ fetchVaultShareValuations(address: string, { txHashes, chainId }: VaultShareValuationsOptions): Promise<VaultShareValuationsResponse>;
154
172
  /**
155
173
  * Fetches current VBA transfers for the wallet authenticated via SIWE.
156
174
  *
@@ -1 +1 @@
1
- {"version":3,"file":"money-account-api-data-service.d.ts","sourceRoot":"","sources":["../src/money-account-api-data-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EACnC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EACV,0BAA0B,EAC1B,YAAY,EACZ,YAAY,EACb,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAEL,GAAG,EAIJ,MAAM,gBAAgB,CAAC;AAMxB,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,yDAAyD,CAAC;AACvH,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EAEjB,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAgB7B,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,YAAY,CAAC;AAIpB;;;GAGG;AACH,eAAO,MAAM,WAAW,+BAA+B,CAAC;AAYxD,eAAO,MAAM,MAAM;aACjB,aAAa,EAAE,mCAAmC;aAClD,YAAY,EAAE,k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kB,GAC3B,OAAO,CAAC,mBAAmB,CAAC,CA2D9B;IAED;;;;;;;;;OASG;IACG,cAAc,CAClB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,CAgD5B;IAED;;;;;OAKG;IACG,iBAAiB,CACrB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,oBAAoB,CAAC,CAiC/B;CAkOF"}
1
+ {"version":3,"file":"money-account-api-data-service.d.ts","sourceRoot":"","sources":["../src/money-account-api-data-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EACnC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EACV,0BAA0B,EAC1B,YAAY,EACZ,YAAY,EACb,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAEL,GAAG,EAOJ,MAAM,gBAAgB,CAAC;AAMxB,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,yDAAyD,CAAC;AACvH,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,4BAA4B,EAE5B,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAiB7B,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,2BAA2B,EAC3B,wBAAwB,EACzB,MAAM,YAAY,CAAC;AAIpB;;;GAGG;AACH,eAAO,MAAM,WAAW,+BAA+B,CAAC;AAYxD,eAAO,MAAM,MAAM;aACjB,aAAa,EAAE,mCAAmC;aAClD,YAAY,EAAE,kCAAkC;aAChD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AAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,mBAAmB,CAAC,CAuC9B;IAED;;;;;;;;;OASG;IACG,cAAc,CAClB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,CA2B5B;IAED;;;;;;;;;;;;;;;OAeG;IACG,yBAAyB,CAC7B,OAAO,EAAE,MAAM,EACf,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,2BAA2B,GACjD,OAAO,CAAC,4BAA4B,CAAC,CAoDvC;IAED;;;;;OAKG;IACG,iBAAiB,CACrB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,oBAAoB,CAAC,CAiC/B;CAkOF"}
@@ -1,11 +1,11 @@
1
1
  import { BaseDataService } from '@metamask/base-data-service';
2
2
  import { handleWhen, HttpError } from '@metamask/controller-utils';
3
3
  import { validate } from '@metamask/superstruct';
4
- import { DEFAULT_STALE_TIME_MS, Env, MONEY_ACCOUNT_API_URL_MAP, RATE_HISTORY_STALE_TIME_MS, VAULT_RATE_STALE_TIME_MS, } from './constants.js';
4
+ import { DEFAULT_STALE_TIME_MS, Env, MONEY_ACCOUNT_API_URL_MAP, RATE_HISTORY_STALE_TIME_MS, VAULT_RATE_STALE_TIME_MS, VAULT_SHARE_VALUATIONS_COMPLETE_STALE_TIME_MS, VAULT_SHARE_VALUATIONS_MAX_TX_HASHES, VAULT_SHARE_VALUATIONS_PARTIAL_STALE_TIME_MS, } from './constants.js';
5
5
  import { MoneyAccountApiHttpError, MoneyAccountApiResponseValidationError, } from './errors.js';
6
6
  import { projectLogger, createModuleLogger } from './logger.js';
7
7
  import { getSiweMessageTemplate, validateSiweChallengeMessage, } from './siwe-message.js';
8
- import { HistoryResponseStruct, InterestResponseStruct, PositionResponseStruct, RateHistoryResponseStruct, VaultRateResponseStruct, VbaSiweChallengeResponseStruct, VbaSiweSessionResponseStruct, VbaTransfersResponseStruct, } from './structs.js';
8
+ import { HistoryResponseStruct, InterestResponseStruct, PositionResponseStruct, RateHistoryResponseStruct, VaultRateResponseStruct, VaultShareValuationsResponseStruct, VbaSiweChallengeResponseStruct, VbaSiweSessionResponseStruct, VbaTransfersResponseStruct, } from './structs.js';
9
9
  // === GENERAL ===
10
10
  /**
11
11
  * The name of the {@link MoneyAccountApiDataService}, used to namespace the
@@ -26,6 +26,7 @@ export const TRACES = {
26
26
  HISTORY_API: 'Money Account API Fetch History',
27
27
  RATE_HISTORY_API: 'Money Account API Fetch Rate History',
28
28
  VAULT_RATE_API: 'Money Account API Fetch Vault Rate',
29
+ VAULT_SHARE_VALUATIONS_API: 'Money Account API Fetch Vault Share Valuations',
29
30
  };
30
31
  // === MESSENGER ===
31
32
  const MESSENGER_EXPOSED_METHODS = [
@@ -34,6 +35,7 @@ const MESSENGER_EXPOSED_METHODS = [
34
35
  'fetchHistory',
35
36
  'fetchRateHistory',
36
37
  'fetchVaultRate',
38
+ 'fetchVaultShareValuations',
37
39
  'fetchVbaTransfers',
38
40
  ];
39
41
  /**
@@ -100,6 +102,29 @@ export class MoneyAccountApiDataService extends BaseDataService {
100
102
  return {};
101
103
  }
102
104
  }
105
+ /**
106
+ * Fetches a URL with the best-effort profile bearer token and validates the
107
+ * response body.
108
+ *
109
+ * @param url - The request URL.
110
+ * @param responseStruct - The struct that defines the expected body.
111
+ * @param endpointLabel - Endpoint name used in error messages.
112
+ * @returns The validated response body.
113
+ */
114
+ async #fetchValidated(url, responseStruct, endpointLabel) {
115
+ const response = await fetch(url, {
116
+ headers: await this.#getRequestHeaders(),
117
+ });
118
+ if (!response.ok) {
119
+ throw await MoneyAccountApiHttpError.fromResponse(response, `Money Account API ${endpointLabel} request failed with status '${response.status}'`);
120
+ }
121
+ const json = await response.json();
122
+ const [error, validated] = validate(json, responseStruct);
123
+ if (error) {
124
+ throw new MoneyAccountApiResponseValidationError(`Malformed response from ${endpointLabel} endpoint: ${error.message}`);
125
+ }
126
+ return validated;
127
+ }
103
128
  /**
104
129
  * Fetches the current vault positions for a given user address.
105
130
  *
@@ -200,20 +225,7 @@ export class MoneyAccountApiDataService extends BaseDataService {
200
225
  return this.#traceNetworkRequest({
201
226
  name: TRACES.INTEREST_API,
202
227
  data: { operation: 'fetchInterest' },
203
- }, async () => {
204
- const response = await fetch(url, {
205
- headers: await this.#getRequestHeaders(),
206
- });
207
- if (!response.ok) {
208
- throw await MoneyAccountApiHttpError.fromResponse(response, `Money Account API interest request failed with status '${response.status}'`);
209
- }
210
- const json = await response.json();
211
- const [error, validated] = validate(json, InterestResponseStruct);
212
- if (error) {
213
- throw new MoneyAccountApiResponseValidationError(`Malformed response from interest endpoint: ${error.message}`);
214
- }
215
- return validated;
216
- });
228
+ }, async () => this.#fetchValidated(url, InterestResponseStruct, 'interest'));
217
229
  },
218
230
  });
219
231
  }
@@ -262,20 +274,7 @@ export class MoneyAccountApiDataService extends BaseDataService {
262
274
  return this.#traceNetworkRequest({
263
275
  name: TRACES.HISTORY_API,
264
276
  data: { operation: 'fetchHistory' },
265
- }, async () => {
266
- const response = await fetch(url, {
267
- headers: await this.#getRequestHeaders(),
268
- });
269
- if (!response.ok) {
270
- throw await MoneyAccountApiHttpError.fromResponse(response, `Money Account API history request failed with status '${response.status}'`);
271
- }
272
- const json = await response.json();
273
- const [error, validated] = validate(json, HistoryResponseStruct);
274
- if (error) {
275
- throw new MoneyAccountApiResponseValidationError(`Malformed response from history endpoint: ${error.message}`);
276
- }
277
- return validated;
278
- });
277
+ }, async () => this.#fetchValidated(url, HistoryResponseStruct, 'history'));
279
278
  },
280
279
  }, options?.cursor ?? undefined);
281
280
  }
@@ -310,20 +309,7 @@ export class MoneyAccountApiDataService extends BaseDataService {
310
309
  return this.#traceNetworkRequest({
311
310
  name: TRACES.RATE_HISTORY_API,
312
311
  data: { operation: 'fetchRateHistory' },
313
- }, async () => {
314
- const response = await fetch(url, {
315
- headers: await this.#getRequestHeaders(),
316
- });
317
- if (!response.ok) {
318
- throw await MoneyAccountApiHttpError.fromResponse(response, `Money Account API rate-history request failed with status '${response.status}'`);
319
- }
320
- const json = await response.json();
321
- const [error, validated] = validate(json, RateHistoryResponseStruct);
322
- if (error) {
323
- throw new MoneyAccountApiResponseValidationError(`Malformed response from rate-history endpoint: ${error.message}`);
324
- }
325
- return validated;
326
- });
312
+ }, async () => this.#fetchValidated(url, RateHistoryResponseStruct, 'rate-history'));
327
313
  },
328
314
  });
329
315
  }
@@ -353,20 +339,59 @@ export class MoneyAccountApiDataService extends BaseDataService {
353
339
  return this.#traceNetworkRequest({
354
340
  name: TRACES.VAULT_RATE_API,
355
341
  data: { operation: 'fetchVaultRate' },
356
- }, async () => {
357
- const response = await fetch(url, {
358
- headers: await this.#getRequestHeaders(),
359
- });
360
- if (!response.ok) {
361
- throw await MoneyAccountApiHttpError.fromResponse(response, `Money Account API vault rate request failed with status '${response.status}'`);
362
- }
363
- const json = await response.json();
364
- const [error, validated] = validate(json, VaultRateResponseStruct);
365
- if (error) {
366
- throw new MoneyAccountApiResponseValidationError(`Malformed response from vault rate endpoint: ${error.message}`);
367
- }
368
- return validated;
369
- });
342
+ }, async () => this.#fetchValidated(url, VaultRateResponseStruct, 'vault rate'));
343
+ },
344
+ });
345
+ }
346
+ /**
347
+ * Batch-values vault share movements in past transactions. Each result
348
+ * reports the shares moved and what they were worth in the vault's
349
+ * underlying asset at that block. Unknown transactions come back with
350
+ * `found: false` instead of failing the batch.
351
+ *
352
+ * @param address - The user's Ethereum address.
353
+ * @param options - Transaction hashes to value and an optional chain ID.
354
+ * @param options.txHashes - Transaction hashes. At most 50 distinct hashes
355
+ * after lowercasing and de-duplication.
356
+ * @param options.chainId - Chain ID of the transactions. Omitted requests use
357
+ * the API default (Monad, 143).
358
+ * @returns One result per requested hash, in request order.
359
+ * @throws An `Error` before any request when `txHashes` is empty or contains
360
+ * more than 50 distinct hashes.
361
+ */
362
+ async fetchVaultShareValuations(address, { txHashes, chainId }) {
363
+ const normalizedAddress = address.toLowerCase();
364
+ const distinctTxHashes = [
365
+ ...new Set(txHashes.map((hash) => hash.toLowerCase())),
366
+ ];
367
+ if (distinctTxHashes.length === 0) {
368
+ throw new Error('At least one transaction hash is required');
369
+ }
370
+ if (distinctTxHashes.length > VAULT_SHARE_VALUATIONS_MAX_TX_HASHES) {
371
+ throw new Error(`At most ${VAULT_SHARE_VALUATIONS_MAX_TX_HASHES} distinct transaction hashes are supported`);
372
+ }
373
+ const txHashesParam = distinctTxHashes.join(',');
374
+ const url = new URL(`/v1/positions/${normalizedAddress}/vault-share-valuations`, this.#baseUrl);
375
+ url.searchParams.append('tx_hashes', txHashesParam);
376
+ if (chainId !== undefined) {
377
+ url.searchParams.append('chain_id', String(chainId));
378
+ }
379
+ return this.fetchQuery({
380
+ queryKey: [
381
+ `${this.name}:fetchVaultShareValuations`,
382
+ normalizedAddress,
383
+ txHashesParam,
384
+ chainId ?? null,
385
+ ],
386
+ staleTime: (query) => query.state.data?.results.every((result) => result.found)
387
+ ? VAULT_SHARE_VALUATIONS_COMPLETE_STALE_TIME_MS
388
+ : VAULT_SHARE_VALUATIONS_PARTIAL_STALE_TIME_MS,
389
+ gcTime: VAULT_SHARE_VALUATIONS_COMPLETE_STALE_TIME_MS,
390
+ queryFn: async () => {
391
+ return this.#traceNetworkRequest({
392
+ name: TRACES.VAULT_SHARE_VALUATIONS_API,
393
+ data: { operation: 'fetchVaultShareValuations' },
394
+ }, async () => this.#fetchValidated(url, VaultShareValuationsResponseStruct, 'vault share valuations'));
370
395
  },
371
396
  });
372
397
  }
@@ -1 +1 @@
1
- {"version":3,"file":"money-account-api-data-service.js","sourceRoot":"","sources":["../src/money-account-api-data-service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAM9D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EACL,qBAAqB,EACrB,GAAG,EACH,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,OAAO;gBACV,SAAS;gBACT,IAAI,EAAE;oBACJ,GAAG,OAAO,CAAC,IAAI;oBACf,OAAO;oBACP,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBACpC;aACF,CAAC;YACF,MAAM,YAAY,GAAG,CAAC,UAAmB,EAAQ,EAAE;gBACjD,WAAW,CAAC,sBAAsB,EAAE;oBAClC,SAAS,EAAE,OAAO,CAAC,IAAI;oBACvB,UAAU;iBACX,CAAC,CAAC;YACL,CAAC,CAAC;YAEF,IAAI,CAAC;gBACH,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAC/D,YAAY,CACb,CAAC;YACJ,CAAC;YAAC,OAAO,UAAU,EAAE,CAAC;gBACpB,YAAY,CAAC,UAAU,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import type {\n DataServiceCacheUpdatedEvent,\n DataServiceGranularCacheUpdatedEvent,\n DataServiceInvalidateQueriesAction,\n} from '@metamask/base-data-service';\nimport { BaseDataService } from '@metamask/base-data-service';\nimport type {\n CreateServicePolicyOptions,\n TraceContext,\n TraceRequest,\n} from '@metamask/controller-utils';\nimport { handleWhen, HttpError } from '@metamask/controller-utils';\nimport type { Messenger } from '@metamask/messenger';\nimport { validate } from '@metamask/superstruct';\nimport type { QueryClientConfig } from '@tanstack/query-core';\n\nimport {\n DEFAULT_STALE_TIME_MS,\n Env,\n MONEY_ACCOUNT_API_URL_MAP,\n RATE_HISTORY_STALE_TIME_MS,\n VAULT_RATE_STALE_TIME_MS,\n} from './constants.js';\nimport {\n MoneyAccountApiHttpError,\n MoneyAccountApiResponseValidationError,\n} from './errors.js';\nimport { projectLogger, createModuleLogger } from './logger.js';\nimport type { MoneyAccountApiDataServiceMethodActions } from './money-account-api-data-service-method-action-types.js';\nimport type {\n HistoryResponse,\n InterestResponse,\n PositionResponse,\n RateHistoryResponse,\n VaultRateResponse,\n VbaSiweChallengeResponse,\n VbaTransfersResponse,\n} from './response.types.js';\nimport type { SiweMessageTemplate } from './siwe-message.js';\nimport {\n getSiweMessageTemplate,\n validateSiweChallengeMessage,\n} from './siwe-message.js';\nimport {\n HistoryResponseStruct,\n InterestResponseStruct,\n PositionResponseStruct,\n RateHistoryResponseStruct,\n VaultRateResponseStruct,\n VbaSiweChallengeResponseStruct,\n VbaSiweSessionResponseStruct,\n VbaTransfersResponseStruct,\n} from './structs.js';\nimport type {\n HistoryOptions,\n InterestOptions,\n RateHistoryOptions,\n FetchPositionsOptions,\n VaultRateOptions,\n FetchVbaTransfersOptions,\n} from './types.js';\n\n// === GENERAL ===\n\n/**\n * The name of the {@link MoneyAccountApiDataService}, used to namespace the\n * service's actions and events.\n */\nexport const serviceName = 'MoneyAccountApiDataService';\n\nconst log = createModuleLogger(projectLogger, serviceName);\nconst traceLogger = createModuleLogger(projectLogger, 'trace');\n\nclass SiweSigningError extends Error {\n constructor(cause: unknown) {\n super('Failed to sign the SIWE message', { cause });\n this.name = 'SiweSigningError';\n }\n}\n\nexport const TRACES = {\n POSITIONS_API: 'Money Account API Fetch Positions',\n INTEREST_API: 'Money Account API Fetch Interest',\n HISTORY_API: 'Money Account API Fetch History',\n RATE_HISTORY_API: 'Money Account API Fetch Rate History',\n VAULT_RATE_API: 'Money Account API Fetch Vault Rate',\n} as const;\n\nexport type MoneyAccountApiDataServiceTraceName =\n (typeof TRACES)[keyof typeof TRACES];\n\nexport type MoneyAccountApiDataServiceTraceRequest = Omit<\n TraceRequest,\n 'name'\n> & {\n name: MoneyAccountApiDataServiceTraceName;\n startTime?: number;\n};\n\nexport type MoneyAccountApiDataServiceTraceCallback = <ReturnType>(\n request: MoneyAccountApiDataServiceTraceRequest,\n fn?: (context?: TraceContext) => ReturnType,\n) => Promise<ReturnType>;\n\n// === MESSENGER ===\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'fetchPositions',\n 'fetchInterest',\n 'fetchHistory',\n 'fetchRateHistory',\n 'fetchVaultRate',\n 'fetchVbaTransfers',\n] as const;\n\n/**\n * Invalidates cached queries for {@link MoneyAccountApiDataService}.\n */\nexport type MoneyAccountApiDataServiceInvalidateQueriesAction =\n DataServiceInvalidateQueriesAction<typeof serviceName>;\n\n/**\n * Actions that {@link MoneyAccountApiDataService} exposes to other consumers.\n */\nexport type MoneyAccountApiDataServiceActions =\n | MoneyAccountApiDataServiceMethodActions\n | MoneyAccountApiDataServiceInvalidateQueriesAction;\n\n/**\n * Actions from other messengers that {@link MoneyAccountApiDataService} calls.\n */\ntype AuthenticationControllerGetBearerTokenAction = {\n type: 'AuthenticationController:getBearerToken';\n handler: (entropySourceId?: string) => Promise<string>;\n};\n\ntype KeyringControllerSignPersonalMessageAction = {\n type: 'KeyringController:signPersonalMessage';\n handler: (messageParams: { data: string; from: string }) => Promise<string>;\n};\n\ntype AllowedActions =\n | AuthenticationControllerGetBearerTokenAction\n | KeyringControllerSignPersonalMessageAction;\n\n/**\n * Published when {@link MoneyAccountApiDataService}'s cache is updated.\n */\nexport type MoneyAccountApiDataServiceCacheUpdatedEvent =\n DataServiceCacheUpdatedEvent<typeof serviceName>;\n\n/**\n * Published when a key within {@link MoneyAccountApiDataService}'s cache is\n * updated.\n */\nexport type MoneyAccountApiDataServiceGranularCacheUpdatedEvent =\n DataServiceGranularCacheUpdatedEvent<typeof serviceName>;\n\n/**\n * Events that {@link MoneyAccountApiDataService} exposes to other consumers.\n */\nexport type MoneyAccountApiDataServiceEvents =\n | MoneyAccountApiDataServiceCacheUpdatedEvent\n | MoneyAccountApiDataServiceGranularCacheUpdatedEvent;\n\n/**\n * Events from other messengers that {@link MoneyAccountApiDataService}\n * subscribes to.\n */\ntype AllowedEvents = never;\n\n/**\n * The messenger which is restricted to actions and events accessed by\n * {@link MoneyAccountApiDataService}.\n */\nexport type MoneyAccountApiDataServiceMessenger = Messenger<\n typeof serviceName,\n MoneyAccountApiDataServiceActions | AllowedActions,\n MoneyAccountApiDataServiceEvents | AllowedEvents\n>;\n\n// === SERVICE DEFINITION ===\n\nexport type MoneyAccountApiDataServiceOptions = {\n messenger: MoneyAccountApiDataServiceMessenger;\n env?: Env;\n queryClientConfig?: QueryClientConfig;\n policyOptions?: CreateServicePolicyOptions;\n trace?: MoneyAccountApiDataServiceTraceCallback;\n};\n\n/**\n * Data service responsible for fetching positions, interest, cash-flow\n * history, vault rate history, and the current vault exchange rate from the\n * Money Account APY Tracking API.\n */\nexport class MoneyAccountApiDataService extends BaseDataService<\n typeof serviceName,\n MoneyAccountApiDataServiceMessenger\n> {\n readonly #baseUrl: string;\n\n readonly #siweTemplate: SiweMessageTemplate;\n\n readonly #trace: MoneyAccountApiDataServiceTraceCallback;\n\n readonly #siweSessions = new Map<\n string,\n { token: string; expiresAt: number }\n >();\n\n readonly #siweSessionRequests = new Map<string, Promise<string>>();\n\n /**\n * Constructs a new MoneyAccountApiDataService.\n *\n * @param options - The constructor arguments.\n * @param options.messenger - The messenger suited for this service.\n * @param options.env - The target environment. Defaults to production.\n * @param options.queryClientConfig - Configuration for the underlying\n * TanStack Query client.\n * @param options.policyOptions - Options to pass to `createServicePolicy`.\n * @param options.trace - Optional callback to trace network requests.\n */\n constructor({\n messenger,\n env = Env.PRD,\n queryClientConfig = {},\n policyOptions = {},\n trace,\n }: MoneyAccountApiDataServiceOptions) {\n super({\n name: serviceName,\n messenger,\n queryClientConfig,\n policyOptions: {\n retryFilterPolicy: handleWhen(\n (error) =>\n !(error instanceof MoneyAccountApiResponseValidationError) &&\n !(error instanceof SiweSigningError) &&\n !(\n error instanceof HttpError &&\n [401, 403].includes(error.httpStatus)\n ),\n ),\n ...policyOptions,\n },\n });\n\n this.#baseUrl = MONEY_ACCOUNT_API_URL_MAP[env];\n this.#siweTemplate = getSiweMessageTemplate(this.#baseUrl);\n\n this.#trace =\n trace ??\n (async <Result>(\n _request: MoneyAccountApiDataServiceTraceRequest,\n fn?: (context?: TraceContext) => Result,\n ): Promise<Result> => {\n return await Promise.resolve(fn?.() as Result);\n });\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n\n log('Initialized', { env, baseUrl: this.#baseUrl });\n }\n\n /**\n * Builds best-effort authentication headers for a Money Account API request.\n *\n * Requests proceed without authentication when the wallet is locked, the\n * user is signed out, or the token is otherwise unavailable. The API edge\n * rate limiter falls back to IP-based limiting when the header is omitted.\n *\n * @returns The Authorization header when a profile token is available.\n */\n async #getRequestHeaders(): Promise<Record<string, string>> {\n try {\n const token = await this.messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n return token ? { Authorization: `Bearer ${token}` } : {};\n } catch (error: unknown) {\n log('Auth token unavailable, proceeding unauthenticated', error);\n return {};\n }\n }\n\n /**\n * Fetches the current vault positions for a given user address.\n *\n * @param address - The user's Ethereum address.\n * @param options - Optional fetch options.\n * @param options.fresh - When true, cancels in-flight reads, fetches with a\n * zero stale time, invalidates the result for subsequent reads, and asks the\n * Money API to skip its Nest response cache with `Cache-Control: no-cache`.\n * @returns The position response containing vault positions and an optional\n * `balance` summary (`null` when the API balance path is unavailable).\n */\n async fetchPositions(\n address: string,\n { fresh = false }: FetchPositionsOptions = {},\n ): Promise<PositionResponse> {\n const normalizedAddress = address.toLowerCase();\n const queryKey = [\n `${this.name}:fetchPositions`,\n normalizedAddress,\n ] as const;\n\n if (fresh) {\n // Cancel any in-flight non-fresh fetch so it cannot win the shared\n // queryKey and re-seed a response that omitted Cache-Control: no-cache.\n await this.cancelQueries({ queryKey: [...queryKey] });\n }\n\n const result = await this.fetchQuery({\n queryKey: [...queryKey],\n staleTime: fresh ? 0 : DEFAULT_STALE_TIME_MS,\n queryFn: async () => {\n return this.#fetchPositionsFromNetwork(normalizedAddress, fresh);\n },\n });\n\n if (fresh) {\n // The balance service may reject this body using minBlock. Keep it\n // available to this caller, but do not let a later steady-state request\n // treat it as warm merely because that request has a non-zero staleTime.\n await this.invalidateQueries({\n queryKey: [...queryKey],\n refetchType: 'none',\n });\n }\n\n return result;\n }\n\n /**\n * Performs the HTTP GET for `/v1/positions/:address`.\n *\n * @param normalizedAddress - Lowercased account address.\n * @param fresh - When true, send `Cache-Control: no-cache`.\n * @returns Validated positions response.\n */\n async #fetchPositionsFromNetwork(\n normalizedAddress: string,\n fresh: boolean,\n ): Promise<PositionResponse> {\n const url = new URL(`/v1/positions/${normalizedAddress}`, this.#baseUrl);\n\n return this.#traceNetworkRequest(\n {\n name: TRACES.POSITIONS_API,\n data: {\n operation: 'fetchPositions',\n ...(fresh ? { fresh: true } : {}),\n },\n },\n async () => {\n const headers = {\n ...(await this.#getRequestHeaders()),\n ...(fresh ? { 'Cache-Control': 'no-cache' } : {}),\n };\n\n const response = await fetch(url, { headers });\n\n if (!response.ok) {\n throw await MoneyAccountApiHttpError.fromResponse(\n response,\n `Money Account API positions request failed with status '${response.status}'`,\n );\n }\n\n const json: unknown = await response.json();\n\n const [error, validated] = validate(json, PositionResponseStruct);\n if (error) {\n throw new MoneyAccountApiResponseValidationError(\n `Malformed response from positions endpoint: ${error.message}`,\n );\n }\n\n return validated;\n },\n );\n }\n\n /**\n * Fetches the interest earned for a given address and vault over a\n * specified time window.\n *\n * @param address - The user's Ethereum address.\n * @param options - Options specifying vault, window, and optional chain ID.\n * @returns The interest response.\n */\n async fetchInterest(\n address: string,\n options: InterestOptions,\n ): Promise<InterestResponse> {\n const url = new URL(\n `/v1/positions/${address.toLowerCase()}/interest`,\n this.#baseUrl,\n );\n url.searchParams.append(\n 'vault_address',\n options.vaultAddress.toLowerCase(),\n );\n url.searchParams.append('window', options.window);\n if (options.chainId !== undefined) {\n url.searchParams.append('chain_id', String(options.chainId));\n }\n\n return this.fetchQuery({\n queryKey: [\n `${this.name}:fetchInterest`,\n address.toLowerCase(),\n options.vaultAddress.toLowerCase(),\n options.window,\n ...(options.chainId === undefined ? [] : [options.chainId]),\n ],\n staleTime: DEFAULT_STALE_TIME_MS,\n queryFn: async () => {\n return this.#traceNetworkRequest(\n {\n name: TRACES.INTEREST_API,\n data: { operation: 'fetchInterest' },\n },\n async () => {\n const response = await fetch(url, {\n headers: await this.#getRequestHeaders(),\n });\n\n if (!response.ok) {\n throw await MoneyAccountApiHttpError.fromResponse(\n response,\n `Money Account API interest request failed with status '${response.status}'`,\n );\n }\n\n const json: unknown = await response.json();\n\n const [error, validated] = validate(json, InterestResponseStruct);\n if (error) {\n throw new MoneyAccountApiResponseValidationError(\n `Malformed response from interest endpoint: ${error.message}`,\n );\n }\n\n return validated;\n },\n );\n },\n });\n }\n\n /**\n * Fetches cursor-paginated cash-flow history for a given address.\n * Uses `fetchInfiniteQuery` for proper TanStack Query pagination semantics.\n *\n * When paginating, consumers must re-pass the same filter options\n * (`vaultAddress`, `chainId`, `limit`) alongside `cursor` on every page\n * request. This ensures the query key matches the original infinite query\n * and that the HTTP request includes the correct filters.\n *\n * @param address - The user's Ethereum address.\n * @param options - Optional filtering and pagination options.\n * @returns The history response containing cash-flow entries for the requested page.\n */\n async fetchHistory(\n address: string,\n options?: HistoryOptions,\n ): Promise<HistoryResponse> {\n const normalizedAddress = address.toLowerCase();\n const normalizedVault = options?.vaultAddress?.toLowerCase() ?? null;\n\n return this.fetchInfiniteQuery<HistoryResponse>(\n {\n queryKey: [\n `${this.name}:fetchHistory`,\n normalizedAddress,\n normalizedVault,\n options?.chainId ?? null,\n options?.limit ?? null,\n ],\n initialPageParam: null,\n getNextPageParam: (result) => result.next_cursor,\n staleTime: DEFAULT_STALE_TIME_MS,\n queryFn: async (context) => {\n const cursor = context.pageParam as string | null | undefined;\n\n const url = new URL(\n `/v1/positions/${normalizedAddress}/history`,\n this.#baseUrl,\n );\n if (normalizedVault) {\n url.searchParams.append('vault_address', normalizedVault);\n }\n if (options?.chainId !== undefined) {\n url.searchParams.append('chain_id', String(options.chainId));\n }\n if (cursor) {\n url.searchParams.append('cursor', cursor);\n }\n if (options?.limit !== undefined) {\n url.searchParams.append('limit', String(options.limit));\n }\n\n return this.#traceNetworkRequest(\n {\n name: TRACES.HISTORY_API,\n data: { operation: 'fetchHistory' },\n },\n async () => {\n const response = await fetch(url, {\n headers: await this.#getRequestHeaders(),\n });\n\n if (!response.ok) {\n throw await MoneyAccountApiHttpError.fromResponse(\n response,\n `Money Account API history request failed with status '${response.status}'`,\n );\n }\n\n const json: unknown = await response.json();\n\n const [error, validated] = validate(json, HistoryResponseStruct);\n if (error) {\n throw new MoneyAccountApiResponseValidationError(\n `Malformed response from history endpoint: ${error.message}`,\n );\n }\n\n return validated;\n },\n );\n },\n },\n options?.cursor ?? undefined,\n );\n }\n\n /**\n * Fetches the exchange-rate time series for a given vault.\n *\n * @param vaultAddress - The vault's Ethereum address.\n * @param options - Optional range and chain ID filters.\n * @returns The rate history response.\n */\n async fetchRateHistory(\n vaultAddress: string,\n options?: RateHistoryOptions,\n ): Promise<RateHistoryResponse> {\n const url = new URL(\n `/v1/vaults/${vaultAddress.toLowerCase()}/rate-history`,\n this.#baseUrl,\n );\n if (options?.chainId !== undefined) {\n url.searchParams.append('chain_id', String(options.chainId));\n }\n if (options?.from) {\n url.searchParams.append('from', options.from);\n }\n if (options?.to) {\n url.searchParams.append('to', options.to);\n }\n\n return this.fetchQuery({\n queryKey: [\n `${this.name}:fetchRateHistory`,\n vaultAddress.toLowerCase(),\n ...(options?.chainId === undefined ? [null] : [options.chainId]),\n ...(options?.from ? [options.from] : [null]),\n ...(options?.to ? [options.to] : [null]),\n ],\n staleTime: RATE_HISTORY_STALE_TIME_MS,\n queryFn: async () => {\n return this.#traceNetworkRequest(\n {\n name: TRACES.RATE_HISTORY_API,\n data: { operation: 'fetchRateHistory' },\n },\n async () => {\n const response = await fetch(url, {\n headers: await this.#getRequestHeaders(),\n });\n\n if (!response.ok) {\n throw await MoneyAccountApiHttpError.fromResponse(\n response,\n `Money Account API rate-history request failed with status '${response.status}'`,\n );\n }\n\n const json: unknown = await response.json();\n\n const [error, validated] = validate(\n json,\n RateHistoryResponseStruct,\n );\n if (error) {\n throw new MoneyAccountApiResponseValidationError(\n `Malformed response from rate-history endpoint: ${error.message}`,\n );\n }\n\n return validated;\n },\n );\n },\n });\n }\n\n /**\n * Fetches the current Accountant exchange rate for a vault.\n *\n * The server returns 404 when the vault is not in the deployment registry\n * or has no indexed rate yet.\n *\n * @param vaultAddress - The vault's Ethereum address.\n * @param options - Optional chain ID filter. Omitted requests use the API default.\n * @returns The current vault rate response.\n */\n async fetchVaultRate(\n vaultAddress: string,\n options?: VaultRateOptions,\n ): Promise<VaultRateResponse> {\n const url = new URL(\n `/v1/vaults/${vaultAddress.toLowerCase()}/rate`,\n this.#baseUrl,\n );\n if (options?.chainId !== undefined) {\n url.searchParams.append('chain_id', String(options.chainId));\n }\n\n return this.fetchQuery({\n queryKey: [\n `${this.name}:fetchVaultRate`,\n vaultAddress.toLowerCase(),\n options?.chainId ?? null,\n ],\n staleTime: VAULT_RATE_STALE_TIME_MS,\n queryFn: async () => {\n return this.#traceNetworkRequest(\n {\n name: TRACES.VAULT_RATE_API,\n data: { operation: 'fetchVaultRate' },\n },\n async () => {\n const response = await fetch(url, {\n headers: await this.#getRequestHeaders(),\n });\n\n if (!response.ok) {\n throw await MoneyAccountApiHttpError.fromResponse(\n response,\n `Money Account API vault rate request failed with status '${response.status}'`,\n );\n }\n\n const json: unknown = await response.json();\n\n const [error, validated] = validate(json, VaultRateResponseStruct);\n if (error) {\n throw new MoneyAccountApiResponseValidationError(\n `Malformed response from vault rate endpoint: ${error.message}`,\n );\n }\n\n return validated;\n },\n );\n },\n });\n }\n\n /**\n * Fetches current VBA transfers for the wallet authenticated via SIWE.\n *\n * @param options - Fetch options, including the wallet address to authenticate.\n * @returns Current transfers belonging to the authenticated wallet.\n */\n async fetchVbaTransfers(\n options: FetchVbaTransfersOptions,\n ): Promise<VbaTransfersResponse> {\n const normalizedAddress = options.address.toLowerCase();\n const queryKey = [\n `${this.name}:fetchVbaTransfers`,\n normalizedAddress,\n ] as const;\n\n // Session signing is not retried by the service policy, while parallel\n // calls for this wallet share the in-flight SIWE exchange below.\n try {\n return await this.fetchQuery({\n queryKey,\n staleTime: 0,\n queryFn: async () => {\n const token = await this.#getSiweToken(normalizedAddress);\n const response = await this.#fetchVbaTransfersWithToken(token);\n if (response.status !== 401) {\n return this.#parseVbaTransfersResponse(response);\n }\n\n this.#siweSessions.delete(normalizedAddress);\n const renewedToken = await this.#getSiweToken(normalizedAddress);\n const retriedResponse =\n await this.#fetchVbaTransfersWithToken(renewedToken);\n return this.#parseVbaTransfersResponse(retriedResponse);\n },\n });\n } catch (error) {\n if (error instanceof HttpError && error.httpStatus === 401) {\n this.#siweSessions.delete(normalizedAddress);\n }\n throw error;\n }\n }\n\n /**\n * Performs the HTTP GET for `/v1/vba/transfers` using a SIWE session token.\n *\n * @param siweToken - The SIWE session bearer token.\n * @returns The raw transfers response.\n */\n async #fetchVbaTransfersWithToken(siweToken: string): Promise<Response> {\n return await fetch(new URL('/v1/vba/transfers', this.#baseUrl), {\n headers: { Authorization: `Bearer ${siweToken}` },\n });\n }\n\n async #parseVbaTransfersResponse(\n response: Response,\n ): Promise<VbaTransfersResponse> {\n if (!response.ok) {\n throw await MoneyAccountApiHttpError.fromResponse(\n response,\n `Money Account API VBA transfers request failed with status '${response.status}'`,\n );\n }\n\n const json: unknown = await response.json();\n const [error, validated] = validate(json, VbaTransfersResponseStruct);\n if (error) {\n throw new MoneyAccountApiResponseValidationError(\n `Malformed response from VBA transfers endpoint: ${error.message}`,\n );\n }\n\n return validated;\n }\n\n async #getSiweToken(normalizedAddress: string): Promise<string> {\n const cachedSession = this.#siweSessions.get(normalizedAddress);\n if (cachedSession && cachedSession.expiresAt > Date.now()) {\n return cachedSession.token;\n }\n this.#siweSessions.delete(normalizedAddress);\n\n const requests = this.#siweSessionRequests;\n const request = requests.get(normalizedAddress);\n if (request !== undefined) {\n return await request;\n }\n\n const newRequest = this.#createSiweSession(normalizedAddress);\n requests.set(normalizedAddress, newRequest);\n try {\n return await newRequest;\n } finally {\n if (requests.get(normalizedAddress) === newRequest) {\n requests.delete(normalizedAddress);\n }\n }\n }\n\n async #createSiweSession(normalizedAddress: string): Promise<string> {\n const challenge = await this.#fetchSiweChallenge(normalizedAddress);\n let signature: string;\n try {\n signature = await this.messenger.call(\n 'KeyringController:signPersonalMessage',\n { data: challenge.message, from: normalizedAddress },\n );\n } catch (error) {\n throw new SiweSigningError(error);\n }\n return await this.#verifySiweChallenge(\n normalizedAddress,\n challenge.message,\n signature,\n );\n }\n\n /**\n * Fetches and validates a SIWE challenge for the given address.\n *\n * The challenge message is verified against the Money Account API's SIWE\n * template before it is returned, so callers never sign a message the\n * service did not expect.\n *\n * @param normalizedAddress - Lowercased account address to authenticate.\n * @returns The validated challenge containing the message to sign.\n */\n async #fetchSiweChallenge(\n normalizedAddress: string,\n ): Promise<VbaSiweChallengeResponse> {\n const challengeResponse = await fetch(\n new URL('/v1/vba/auth/challenge', this.#baseUrl),\n {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ address: normalizedAddress }),\n },\n );\n if (!challengeResponse.ok) {\n throw await MoneyAccountApiHttpError.fromResponse(\n challengeResponse,\n `Money Account API VBA SIWE challenge failed with status '${challengeResponse.status}'`,\n );\n }\n\n const challengeJson: unknown = await challengeResponse.json();\n const [challengeError, challenge] = validate(\n challengeJson,\n VbaSiweChallengeResponseStruct,\n );\n if (challengeError) {\n throw new MoneyAccountApiResponseValidationError(\n `Malformed response from VBA SIWE challenge endpoint: ${challengeError.message}`,\n );\n }\n\n const invalidReason = validateSiweChallengeMessage({\n template: this.#siweTemplate,\n address: normalizedAddress,\n nonce: challenge.nonce,\n message: challenge.message,\n now: Date.now(),\n });\n if (invalidReason) {\n throw new MoneyAccountApiResponseValidationError(\n `Invalid VBA SIWE challenge message: ${invalidReason}`,\n );\n }\n\n return challenge;\n }\n\n /**\n * Verifies a SIWE signature and caches the resulting session.\n *\n * @param normalizedAddress - Lowercased account address being authenticated.\n * @param message - The signed SIWE message.\n * @param signature - The signature produced for the message.\n * @returns The session's access token.\n */\n async #verifySiweChallenge(\n normalizedAddress: string,\n message: string,\n signature: string,\n ): Promise<string> {\n const verifyResponse = await fetch(\n new URL('/v1/vba/auth/verify', this.#baseUrl),\n {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ message, signature }),\n },\n );\n if (!verifyResponse.ok) {\n throw await MoneyAccountApiHttpError.fromResponse(\n verifyResponse,\n `Money Account API VBA SIWE verification failed with status '${verifyResponse.status}'`,\n );\n }\n\n const sessionJson: unknown = await verifyResponse.json();\n const [sessionError, session] = validate(\n sessionJson,\n VbaSiweSessionResponseStruct,\n );\n if (sessionError) {\n throw new MoneyAccountApiResponseValidationError(\n `Malformed response from VBA SIWE verification endpoint: ${sessionError.message}`,\n );\n }\n\n this.#siweSessions.set(normalizedAddress, {\n token: session.access_token,\n expiresAt: Date.now() + session.expires_in * 1000,\n });\n return session.access_token;\n }\n\n /**\n * Runs a network request and emits a best-effort backdated trace.\n *\n * @param request - Trace metadata for the network request.\n * @param fn - Network request to execute.\n * @returns The network request result.\n */\n async #traceNetworkRequest<Result>(\n request: MoneyAccountApiDataServiceTraceRequest,\n fn: () => Promise<Result>,\n ): Promise<Result> {\n const startTime = Date.now();\n let success = false;\n let errorName: string | undefined;\n\n try {\n const result = await fn();\n success = true;\n return result;\n } catch (error) {\n errorName = error instanceof Error ? error.name : typeof error;\n throw error;\n } finally {\n const traceRequest = {\n ...request,\n startTime,\n data: {\n ...request.data,\n success,\n ...(errorName ? { errorName } : {}),\n },\n };\n const onTraceError = (traceError: unknown): void => {\n traceLogger('Failed to emit trace', {\n traceName: request.name,\n traceError,\n });\n };\n\n try {\n Promise.resolve(this.#trace(traceRequest, () => undefined)).catch(\n onTraceError,\n );\n } catch (traceError) {\n onTraceError(traceError);\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"money-account-api-data-service.js","sourceRoot":"","sources":["../src/money-account-api-data-service.ts"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alidateQueriesAction,\n} from '@metamask/base-data-service';\nimport { BaseDataService } from '@metamask/base-data-service';\nimport type {\n CreateServicePolicyOptions,\n TraceContext,\n TraceRequest,\n} from '@metamask/controller-utils';\nimport { handleWhen, HttpError } from '@metamask/controller-utils';\nimport type { Messenger } from '@metamask/messenger';\nimport type { Struct } from '@metamask/superstruct';\nimport { validate } from '@metamask/superstruct';\nimport type { QueryClientConfig } from '@tanstack/query-core';\n\nimport {\n DEFAULT_STALE_TIME_MS,\n Env,\n MONEY_ACCOUNT_API_URL_MAP,\n RATE_HISTORY_STALE_TIME_MS,\n VAULT_RATE_STALE_TIME_MS,\n VAULT_SHARE_VALUATIONS_COMPLETE_STALE_TIME_MS,\n VAULT_SHARE_VALUATIONS_MAX_TX_HASHES,\n VAULT_SHARE_VALUATIONS_PARTIAL_STALE_TIME_MS,\n} from './constants.js';\nimport {\n MoneyAccountApiHttpError,\n MoneyAccountApiResponseValidationError,\n} from './errors.js';\nimport { projectLogger, createModuleLogger } from './logger.js';\nimport type { MoneyAccountApiDataServiceMethodActions } from './money-account-api-data-service-method-action-types.js';\nimport type {\n HistoryResponse,\n InterestResponse,\n PositionResponse,\n RateHistoryResponse,\n VaultRateResponse,\n VaultShareValuationsResponse,\n VbaSiweChallengeResponse,\n VbaTransfersResponse,\n} from './response.types.js';\nimport type { SiweMessageTemplate } from './siwe-message.js';\nimport {\n getSiweMessageTemplate,\n validateSiweChallengeMessage,\n} from './siwe-message.js';\nimport {\n HistoryResponseStruct,\n InterestResponseStruct,\n PositionResponseStruct,\n RateHistoryResponseStruct,\n VaultRateResponseStruct,\n VaultShareValuationsResponseStruct,\n VbaSiweChallengeResponseStruct,\n VbaSiweSessionResponseStruct,\n VbaTransfersResponseStruct,\n} from './structs.js';\nimport type {\n HistoryOptions,\n InterestOptions,\n RateHistoryOptions,\n FetchPositionsOptions,\n VaultRateOptions,\n VaultShareValuationsOptions,\n FetchVbaTransfersOptions,\n} from './types.js';\n\n// === GENERAL ===\n\n/**\n * The name of the {@link MoneyAccountApiDataService}, used to namespace the\n * service's actions and events.\n */\nexport const serviceName = 'MoneyAccountApiDataService';\n\nconst log = createModuleLogger(projectLogger, serviceName);\nconst traceLogger = createModuleLogger(projectLogger, 'trace');\n\nclass SiweSigningError extends Error {\n constructor(cause: unknown) {\n super('Failed to sign the SIWE message', { cause });\n this.name = 'SiweSigningError';\n }\n}\n\nexport const TRACES = {\n POSITIONS_API: 'Money Account API Fetch Positions',\n INTEREST_API: 'Money Account API Fetch Interest',\n HISTORY_API: 'Money Account API Fetch History',\n RATE_HISTORY_API: 'Money Account API Fetch Rate History',\n VAULT_RATE_API: 'Money Account API Fetch Vault Rate',\n VAULT_SHARE_VALUATIONS_API: 'Money Account API Fetch Vault Share Valuations',\n} as const;\n\nexport type MoneyAccountApiDataServiceTraceName =\n (typeof TRACES)[keyof typeof TRACES];\n\nexport type MoneyAccountApiDataServiceTraceRequest = Omit<\n TraceRequest,\n 'name'\n> & {\n name: MoneyAccountApiDataServiceTraceName;\n startTime?: number;\n};\n\nexport type MoneyAccountApiDataServiceTraceCallback = <ReturnType>(\n request: MoneyAccountApiDataServiceTraceRequest,\n fn?: (context?: TraceContext) => ReturnType,\n) => Promise<ReturnType>;\n\n// === MESSENGER ===\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'fetchPositions',\n 'fetchInterest',\n 'fetchHistory',\n 'fetchRateHistory',\n 'fetchVaultRate',\n 'fetchVaultShareValuations',\n 'fetchVbaTransfers',\n] as const;\n\n/**\n * Invalidates cached queries for {@link MoneyAccountApiDataService}.\n */\nexport type MoneyAccountApiDataServiceInvalidateQueriesAction =\n DataServiceInvalidateQueriesAction<typeof serviceName>;\n\n/**\n * Actions that {@link MoneyAccountApiDataService} exposes to other consumers.\n */\nexport type MoneyAccountApiDataServiceActions =\n | MoneyAccountApiDataServiceMethodActions\n | MoneyAccountApiDataServiceInvalidateQueriesAction;\n\n/**\n * Actions from other messengers that {@link MoneyAccountApiDataService} calls.\n */\ntype AuthenticationControllerGetBearerTokenAction = {\n type: 'AuthenticationController:getBearerToken';\n handler: (entropySourceId?: string) => Promise<string>;\n};\n\ntype KeyringControllerSignPersonalMessageAction = {\n type: 'KeyringController:signPersonalMessage';\n handler: (messageParams: { data: string; from: string }) => Promise<string>;\n};\n\ntype AllowedActions =\n | AuthenticationControllerGetBearerTokenAction\n | KeyringControllerSignPersonalMessageAction;\n\n/**\n * Published when {@link MoneyAccountApiDataService}'s cache is updated.\n */\nexport type MoneyAccountApiDataServiceCacheUpdatedEvent =\n DataServiceCacheUpdatedEvent<typeof serviceName>;\n\n/**\n * Published when a key within {@link MoneyAccountApiDataService}'s cache is\n * updated.\n */\nexport type MoneyAccountApiDataServiceGranularCacheUpdatedEvent =\n DataServiceGranularCacheUpdatedEvent<typeof serviceName>;\n\n/**\n * Events that {@link MoneyAccountApiDataService} exposes to other consumers.\n */\nexport type MoneyAccountApiDataServiceEvents =\n | MoneyAccountApiDataServiceCacheUpdatedEvent\n | MoneyAccountApiDataServiceGranularCacheUpdatedEvent;\n\n/**\n * Events from other messengers that {@link MoneyAccountApiDataService}\n * subscribes to.\n */\ntype AllowedEvents = never;\n\n/**\n * The messenger which is restricted to actions and events accessed by\n * {@link MoneyAccountApiDataService}.\n */\nexport type MoneyAccountApiDataServiceMessenger = Messenger<\n typeof serviceName,\n MoneyAccountApiDataServiceActions | AllowedActions,\n MoneyAccountApiDataServiceEvents | AllowedEvents\n>;\n\n// === SERVICE DEFINITION ===\n\nexport type MoneyAccountApiDataServiceOptions = {\n messenger: MoneyAccountApiDataServiceMessenger;\n env?: Env;\n queryClientConfig?: QueryClientConfig;\n policyOptions?: CreateServicePolicyOptions;\n trace?: MoneyAccountApiDataServiceTraceCallback;\n};\n\n/**\n * Data service responsible for fetching positions, interest, cash-flow\n * history, vault rate history, and the current vault exchange rate from the\n * Money Account APY Tracking API.\n */\nexport class MoneyAccountApiDataService extends BaseDataService<\n typeof serviceName,\n MoneyAccountApiDataServiceMessenger\n> {\n readonly #baseUrl: string;\n\n readonly #siweTemplate: SiweMessageTemplate;\n\n readonly #trace: MoneyAccountApiDataServiceTraceCallback;\n\n readonly #siweSessions = new Map<\n string,\n { token: string; expiresAt: number }\n >();\n\n readonly #siweSessionRequests = new Map<string, Promise<string>>();\n\n /**\n * Constructs a new MoneyAccountApiDataService.\n *\n * @param options - The constructor arguments.\n * @param options.messenger - The messenger suited for this service.\n * @param options.env - The target environment. Defaults to production.\n * @param options.queryClientConfig - Configuration for the underlying\n * TanStack Query client.\n * @param options.policyOptions - Options to pass to `createServicePolicy`.\n * @param options.trace - Optional callback to trace network requests.\n */\n constructor({\n messenger,\n env = Env.PRD,\n queryClientConfig = {},\n policyOptions = {},\n trace,\n }: MoneyAccountApiDataServiceOptions) {\n super({\n name: serviceName,\n messenger,\n queryClientConfig,\n policyOptions: {\n retryFilterPolicy: handleWhen(\n (error) =>\n !(error instanceof MoneyAccountApiResponseValidationError) &&\n !(error instanceof SiweSigningError) &&\n !(\n error instanceof HttpError &&\n [401, 403].includes(error.httpStatus)\n ),\n ),\n ...policyOptions,\n },\n });\n\n this.#baseUrl = MONEY_ACCOUNT_API_URL_MAP[env];\n this.#siweTemplate = getSiweMessageTemplate(this.#baseUrl);\n\n this.#trace =\n trace ??\n (async <Result>(\n _request: MoneyAccountApiDataServiceTraceRequest,\n fn?: (context?: TraceContext) => Result,\n ): Promise<Result> => {\n return await Promise.resolve(fn?.() as Result);\n });\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n\n log('Initialized', { env, baseUrl: this.#baseUrl });\n }\n\n /**\n * Builds best-effort authentication headers for a Money Account API request.\n *\n * Requests proceed without authentication when the wallet is locked, the\n * user is signed out, or the token is otherwise unavailable. The API edge\n * rate limiter falls back to IP-based limiting when the header is omitted.\n *\n * @returns The Authorization header when a profile token is available.\n */\n async #getRequestHeaders(): Promise<Record<string, string>> {\n try {\n const token = await this.messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n return token ? { Authorization: `Bearer ${token}` } : {};\n } catch (error: unknown) {\n log('Auth token unavailable, proceeding unauthenticated', error);\n return {};\n }\n }\n\n /**\n * Fetches a URL with the best-effort profile bearer token and validates the\n * response body.\n *\n * @param url - The request URL.\n * @param responseStruct - The struct that defines the expected body.\n * @param endpointLabel - Endpoint name used in error messages.\n * @returns The validated response body.\n */\n async #fetchValidated<Response>(\n url: URL,\n responseStruct: Struct<Response>,\n endpointLabel: string,\n ): Promise<Response> {\n const response = await fetch(url, {\n headers: await this.#getRequestHeaders(),\n });\n\n if (!response.ok) {\n throw await MoneyAccountApiHttpError.fromResponse(\n response,\n `Money Account API ${endpointLabel} request failed with status '${response.status}'`,\n );\n }\n\n const json: unknown = await response.json();\n\n const [error, validated] = validate(json, responseStruct);\n if (error) {\n throw new MoneyAccountApiResponseValidationError(\n `Malformed response from ${endpointLabel} endpoint: ${error.message}`,\n );\n }\n\n return validated;\n }\n\n /**\n * Fetches the current vault positions for a given user address.\n *\n * @param address - The user's Ethereum address.\n * @param options - Optional fetch options.\n * @param options.fresh - When true, cancels in-flight reads, fetches with a\n * zero stale time, invalidates the result for subsequent reads, and asks the\n * Money API to skip its Nest response cache with `Cache-Control: no-cache`.\n * @returns The position response containing vault positions and an optional\n * `balance` summary (`null` when the API balance path is unavailable).\n */\n async fetchPositions(\n address: string,\n { fresh = false }: FetchPositionsOptions = {},\n ): Promise<PositionResponse> {\n const normalizedAddress = address.toLowerCase();\n const queryKey = [\n `${this.name}:fetchPositions`,\n normalizedAddress,\n ] as const;\n\n if (fresh) {\n // Cancel any in-flight non-fresh fetch so it cannot win the shared\n // queryKey and re-seed a response that omitted Cache-Control: no-cache.\n await this.cancelQueries({ queryKey: [...queryKey] });\n }\n\n const result = await this.fetchQuery({\n queryKey: [...queryKey],\n staleTime: fresh ? 0 : DEFAULT_STALE_TIME_MS,\n queryFn: async () => {\n return this.#fetchPositionsFromNetwork(normalizedAddress, fresh);\n },\n });\n\n if (fresh) {\n // The balance service may reject this body using minBlock. Keep it\n // available to this caller, but do not let a later steady-state request\n // treat it as warm merely because that request has a non-zero staleTime.\n await this.invalidateQueries({\n queryKey: [...queryKey],\n refetchType: 'none',\n });\n }\n\n return result;\n }\n\n /**\n * Performs the HTTP GET for `/v1/positions/:address`.\n *\n * @param normalizedAddress - Lowercased account address.\n * @param fresh - When true, send `Cache-Control: no-cache`.\n * @returns Validated positions response.\n */\n async #fetchPositionsFromNetwork(\n normalizedAddress: string,\n fresh: boolean,\n ): Promise<PositionResponse> {\n const url = new URL(`/v1/positions/${normalizedAddress}`, this.#baseUrl);\n\n return this.#traceNetworkRequest(\n {\n name: TRACES.POSITIONS_API,\n data: {\n operation: 'fetchPositions',\n ...(fresh ? { fresh: true } : {}),\n },\n },\n async () => {\n const headers = {\n ...(await this.#getRequestHeaders()),\n ...(fresh ? { 'Cache-Control': 'no-cache' } : {}),\n };\n\n const response = await fetch(url, { headers });\n\n if (!response.ok) {\n throw await MoneyAccountApiHttpError.fromResponse(\n response,\n `Money Account API positions request failed with status '${response.status}'`,\n );\n }\n\n const json: unknown = await response.json();\n\n const [error, validated] = validate(json, PositionResponseStruct);\n if (error) {\n throw new MoneyAccountApiResponseValidationError(\n `Malformed response from positions endpoint: ${error.message}`,\n );\n }\n\n return validated;\n },\n );\n }\n\n /**\n * Fetches the interest earned for a given address and vault over a\n * specified time window.\n *\n * @param address - The user's Ethereum address.\n * @param options - Options specifying vault, window, and optional chain ID.\n * @returns The interest response.\n */\n async fetchInterest(\n address: string,\n options: InterestOptions,\n ): Promise<InterestResponse> {\n const url = new URL(\n `/v1/positions/${address.toLowerCase()}/interest`,\n this.#baseUrl,\n );\n url.searchParams.append(\n 'vault_address',\n options.vaultAddress.toLowerCase(),\n );\n url.searchParams.append('window', options.window);\n if (options.chainId !== undefined) {\n url.searchParams.append('chain_id', String(options.chainId));\n }\n\n return this.fetchQuery({\n queryKey: [\n `${this.name}:fetchInterest`,\n address.toLowerCase(),\n options.vaultAddress.toLowerCase(),\n options.window,\n ...(options.chainId === undefined ? [] : [options.chainId]),\n ],\n staleTime: DEFAULT_STALE_TIME_MS,\n queryFn: async () => {\n return this.#traceNetworkRequest(\n {\n name: TRACES.INTEREST_API,\n data: { operation: 'fetchInterest' },\n },\n async () =>\n this.#fetchValidated(url, InterestResponseStruct, 'interest'),\n );\n },\n });\n }\n\n /**\n * Fetches cursor-paginated cash-flow history for a given address.\n * Uses `fetchInfiniteQuery` for proper TanStack Query pagination semantics.\n *\n * When paginating, consumers must re-pass the same filter options\n * (`vaultAddress`, `chainId`, `limit`) alongside `cursor` on every page\n * request. This ensures the query key matches the original infinite query\n * and that the HTTP request includes the correct filters.\n *\n * @param address - The user's Ethereum address.\n * @param options - Optional filtering and pagination options.\n * @returns The history response containing cash-flow entries for the requested page.\n */\n async fetchHistory(\n address: string,\n options?: HistoryOptions,\n ): Promise<HistoryResponse> {\n const normalizedAddress = address.toLowerCase();\n const normalizedVault = options?.vaultAddress?.toLowerCase() ?? null;\n\n return this.fetchInfiniteQuery<HistoryResponse>(\n {\n queryKey: [\n `${this.name}:fetchHistory`,\n normalizedAddress,\n normalizedVault,\n options?.chainId ?? null,\n options?.limit ?? null,\n ],\n initialPageParam: null,\n getNextPageParam: (result) => result.next_cursor,\n staleTime: DEFAULT_STALE_TIME_MS,\n queryFn: async (context) => {\n const cursor = context.pageParam as string | null | undefined;\n\n const url = new URL(\n `/v1/positions/${normalizedAddress}/history`,\n this.#baseUrl,\n );\n if (normalizedVault) {\n url.searchParams.append('vault_address', normalizedVault);\n }\n if (options?.chainId !== undefined) {\n url.searchParams.append('chain_id', String(options.chainId));\n }\n if (cursor) {\n url.searchParams.append('cursor', cursor);\n }\n if (options?.limit !== undefined) {\n url.searchParams.append('limit', String(options.limit));\n }\n\n return this.#traceNetworkRequest(\n {\n name: TRACES.HISTORY_API,\n data: { operation: 'fetchHistory' },\n },\n async () =>\n this.#fetchValidated(url, HistoryResponseStruct, 'history'),\n );\n },\n },\n options?.cursor ?? undefined,\n );\n }\n\n /**\n * Fetches the exchange-rate time series for a given vault.\n *\n * @param vaultAddress - The vault's Ethereum address.\n * @param options - Optional range and chain ID filters.\n * @returns The rate history response.\n */\n async fetchRateHistory(\n vaultAddress: string,\n options?: RateHistoryOptions,\n ): Promise<RateHistoryResponse> {\n const url = new URL(\n `/v1/vaults/${vaultAddress.toLowerCase()}/rate-history`,\n this.#baseUrl,\n );\n if (options?.chainId !== undefined) {\n url.searchParams.append('chain_id', String(options.chainId));\n }\n if (options?.from) {\n url.searchParams.append('from', options.from);\n }\n if (options?.to) {\n url.searchParams.append('to', options.to);\n }\n\n return this.fetchQuery({\n queryKey: [\n `${this.name}:fetchRateHistory`,\n vaultAddress.toLowerCase(),\n ...(options?.chainId === undefined ? [null] : [options.chainId]),\n ...(options?.from ? [options.from] : [null]),\n ...(options?.to ? [options.to] : [null]),\n ],\n staleTime: RATE_HISTORY_STALE_TIME_MS,\n queryFn: async () => {\n return this.#traceNetworkRequest(\n {\n name: TRACES.RATE_HISTORY_API,\n data: { operation: 'fetchRateHistory' },\n },\n async () =>\n this.#fetchValidated(\n url,\n RateHistoryResponseStruct,\n 'rate-history',\n ),\n );\n },\n });\n }\n\n /**\n * Fetches the current Accountant exchange rate for a vault.\n *\n * The server returns 404 when the vault is not in the deployment registry\n * or has no indexed rate yet.\n *\n * @param vaultAddress - The vault's Ethereum address.\n * @param options - Optional chain ID filter. Omitted requests use the API default.\n * @returns The current vault rate response.\n */\n async fetchVaultRate(\n vaultAddress: string,\n options?: VaultRateOptions,\n ): Promise<VaultRateResponse> {\n const url = new URL(\n `/v1/vaults/${vaultAddress.toLowerCase()}/rate`,\n this.#baseUrl,\n );\n if (options?.chainId !== undefined) {\n url.searchParams.append('chain_id', String(options.chainId));\n }\n\n return this.fetchQuery({\n queryKey: [\n `${this.name}:fetchVaultRate`,\n vaultAddress.toLowerCase(),\n options?.chainId ?? null,\n ],\n staleTime: VAULT_RATE_STALE_TIME_MS,\n queryFn: async () => {\n return this.#traceNetworkRequest(\n {\n name: TRACES.VAULT_RATE_API,\n data: { operation: 'fetchVaultRate' },\n },\n async () =>\n this.#fetchValidated(url, VaultRateResponseStruct, 'vault rate'),\n );\n },\n });\n }\n\n /**\n * Batch-values vault share movements in past transactions. Each result\n * reports the shares moved and what they were worth in the vault's\n * underlying asset at that block. Unknown transactions come back with\n * `found: false` instead of failing the batch.\n *\n * @param address - The user's Ethereum address.\n * @param options - Transaction hashes to value and an optional chain ID.\n * @param options.txHashes - Transaction hashes. At most 50 distinct hashes\n * after lowercasing and de-duplication.\n * @param options.chainId - Chain ID of the transactions. Omitted requests use\n * the API default (Monad, 143).\n * @returns One result per requested hash, in request order.\n * @throws An `Error` before any request when `txHashes` is empty or contains\n * more than 50 distinct hashes.\n */\n async fetchVaultShareValuations(\n address: string,\n { txHashes, chainId }: VaultShareValuationsOptions,\n ): Promise<VaultShareValuationsResponse> {\n const normalizedAddress = address.toLowerCase();\n const distinctTxHashes = [\n ...new Set(txHashes.map((hash) => hash.toLowerCase())),\n ];\n\n if (distinctTxHashes.length === 0) {\n throw new Error('At least one transaction hash is required');\n }\n if (distinctTxHashes.length > VAULT_SHARE_VALUATIONS_MAX_TX_HASHES) {\n throw new Error(\n `At most ${VAULT_SHARE_VALUATIONS_MAX_TX_HASHES} distinct transaction hashes are supported`,\n );\n }\n\n const txHashesParam = distinctTxHashes.join(',');\n const url = new URL(\n `/v1/positions/${normalizedAddress}/vault-share-valuations`,\n this.#baseUrl,\n );\n url.searchParams.append('tx_hashes', txHashesParam);\n if (chainId !== undefined) {\n url.searchParams.append('chain_id', String(chainId));\n }\n\n return this.fetchQuery({\n queryKey: [\n `${this.name}:fetchVaultShareValuations`,\n normalizedAddress,\n txHashesParam,\n chainId ?? null,\n ],\n staleTime: (query) =>\n query.state.data?.results.every((result) => result.found)\n ? VAULT_SHARE_VALUATIONS_COMPLETE_STALE_TIME_MS\n : VAULT_SHARE_VALUATIONS_PARTIAL_STALE_TIME_MS,\n gcTime: VAULT_SHARE_VALUATIONS_COMPLETE_STALE_TIME_MS,\n queryFn: async () => {\n return this.#traceNetworkRequest(\n {\n name: TRACES.VAULT_SHARE_VALUATIONS_API,\n data: { operation: 'fetchVaultShareValuations' },\n },\n async () =>\n this.#fetchValidated(\n url,\n VaultShareValuationsResponseStruct,\n 'vault share valuations',\n ),\n );\n },\n });\n }\n\n /**\n * Fetches current VBA transfers for the wallet authenticated via SIWE.\n *\n * @param options - Fetch options, including the wallet address to authenticate.\n * @returns Current transfers belonging to the authenticated wallet.\n */\n async fetchVbaTransfers(\n options: FetchVbaTransfersOptions,\n ): Promise<VbaTransfersResponse> {\n const normalizedAddress = options.address.toLowerCase();\n const queryKey = [\n `${this.name}:fetchVbaTransfers`,\n normalizedAddress,\n ] as const;\n\n // Session signing is not retried by the service policy, while parallel\n // calls for this wallet share the in-flight SIWE exchange below.\n try {\n return await this.fetchQuery({\n queryKey,\n staleTime: 0,\n queryFn: async () => {\n const token = await this.#getSiweToken(normalizedAddress);\n const response = await this.#fetchVbaTransfersWithToken(token);\n if (response.status !== 401) {\n return this.#parseVbaTransfersResponse(response);\n }\n\n this.#siweSessions.delete(normalizedAddress);\n const renewedToken = await this.#getSiweToken(normalizedAddress);\n const retriedResponse =\n await this.#fetchVbaTransfersWithToken(renewedToken);\n return this.#parseVbaTransfersResponse(retriedResponse);\n },\n });\n } catch (error) {\n if (error instanceof HttpError && error.httpStatus === 401) {\n this.#siweSessions.delete(normalizedAddress);\n }\n throw error;\n }\n }\n\n /**\n * Performs the HTTP GET for `/v1/vba/transfers` using a SIWE session token.\n *\n * @param siweToken - The SIWE session bearer token.\n * @returns The raw transfers response.\n */\n async #fetchVbaTransfersWithToken(siweToken: string): Promise<Response> {\n return await fetch(new URL('/v1/vba/transfers', this.#baseUrl), {\n headers: { Authorization: `Bearer ${siweToken}` },\n });\n }\n\n async #parseVbaTransfersResponse(\n response: Response,\n ): Promise<VbaTransfersResponse> {\n if (!response.ok) {\n throw await MoneyAccountApiHttpError.fromResponse(\n response,\n `Money Account API VBA transfers request failed with status '${response.status}'`,\n );\n }\n\n const json: unknown = await response.json();\n const [error, validated] = validate(json, VbaTransfersResponseStruct);\n if (error) {\n throw new MoneyAccountApiResponseValidationError(\n `Malformed response from VBA transfers endpoint: ${error.message}`,\n );\n }\n\n return validated;\n }\n\n async #getSiweToken(normalizedAddress: string): Promise<string> {\n const cachedSession = this.#siweSessions.get(normalizedAddress);\n if (cachedSession && cachedSession.expiresAt > Date.now()) {\n return cachedSession.token;\n }\n this.#siweSessions.delete(normalizedAddress);\n\n const requests = this.#siweSessionRequests;\n const request = requests.get(normalizedAddress);\n if (request !== undefined) {\n return await request;\n }\n\n const newRequest = this.#createSiweSession(normalizedAddress);\n requests.set(normalizedAddress, newRequest);\n try {\n return await newRequest;\n } finally {\n if (requests.get(normalizedAddress) === newRequest) {\n requests.delete(normalizedAddress);\n }\n }\n }\n\n async #createSiweSession(normalizedAddress: string): Promise<string> {\n const challenge = await this.#fetchSiweChallenge(normalizedAddress);\n let signature: string;\n try {\n signature = await this.messenger.call(\n 'KeyringController:signPersonalMessage',\n { data: challenge.message, from: normalizedAddress },\n );\n } catch (error) {\n throw new SiweSigningError(error);\n }\n return await this.#verifySiweChallenge(\n normalizedAddress,\n challenge.message,\n signature,\n );\n }\n\n /**\n * Fetches and validates a SIWE challenge for the given address.\n *\n * The challenge message is verified against the Money Account API's SIWE\n * template before it is returned, so callers never sign a message the\n * service did not expect.\n *\n * @param normalizedAddress - Lowercased account address to authenticate.\n * @returns The validated challenge containing the message to sign.\n */\n async #fetchSiweChallenge(\n normalizedAddress: string,\n ): Promise<VbaSiweChallengeResponse> {\n const challengeResponse = await fetch(\n new URL('/v1/vba/auth/challenge', this.#baseUrl),\n {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ address: normalizedAddress }),\n },\n );\n if (!challengeResponse.ok) {\n throw await MoneyAccountApiHttpError.fromResponse(\n challengeResponse,\n `Money Account API VBA SIWE challenge failed with status '${challengeResponse.status}'`,\n );\n }\n\n const challengeJson: unknown = await challengeResponse.json();\n const [challengeError, challenge] = validate(\n challengeJson,\n VbaSiweChallengeResponseStruct,\n );\n if (challengeError) {\n throw new MoneyAccountApiResponseValidationError(\n `Malformed response from VBA SIWE challenge endpoint: ${challengeError.message}`,\n );\n }\n\n const invalidReason = validateSiweChallengeMessage({\n template: this.#siweTemplate,\n address: normalizedAddress,\n nonce: challenge.nonce,\n message: challenge.message,\n now: Date.now(),\n });\n if (invalidReason) {\n throw new MoneyAccountApiResponseValidationError(\n `Invalid VBA SIWE challenge message: ${invalidReason}`,\n );\n }\n\n return challenge;\n }\n\n /**\n * Verifies a SIWE signature and caches the resulting session.\n *\n * @param normalizedAddress - Lowercased account address being authenticated.\n * @param message - The signed SIWE message.\n * @param signature - The signature produced for the message.\n * @returns The session's access token.\n */\n async #verifySiweChallenge(\n normalizedAddress: string,\n message: string,\n signature: string,\n ): Promise<string> {\n const verifyResponse = await fetch(\n new URL('/v1/vba/auth/verify', this.#baseUrl),\n {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ message, signature }),\n },\n );\n if (!verifyResponse.ok) {\n throw await MoneyAccountApiHttpError.fromResponse(\n verifyResponse,\n `Money Account API VBA SIWE verification failed with status '${verifyResponse.status}'`,\n );\n }\n\n const sessionJson: unknown = await verifyResponse.json();\n const [sessionError, session] = validate(\n sessionJson,\n VbaSiweSessionResponseStruct,\n );\n if (sessionError) {\n throw new MoneyAccountApiResponseValidationError(\n `Malformed response from VBA SIWE verification endpoint: ${sessionError.message}`,\n );\n }\n\n this.#siweSessions.set(normalizedAddress, {\n token: session.access_token,\n expiresAt: Date.now() + session.expires_in * 1000,\n });\n return session.access_token;\n }\n\n /**\n * Runs a network request and emits a best-effort backdated trace.\n *\n * @param request - Trace metadata for the network request.\n * @param fn - Network request to execute.\n * @returns The network request result.\n */\n async #traceNetworkRequest<Result>(\n request: MoneyAccountApiDataServiceTraceRequest,\n fn: () => Promise<Result>,\n ): Promise<Result> {\n const startTime = Date.now();\n let success = false;\n let errorName: string | undefined;\n\n try {\n const result = await fn();\n success = true;\n return result;\n } catch (error) {\n errorName = error instanceof Error ? error.name : typeof error;\n throw error;\n } finally {\n const traceRequest = {\n ...request,\n startTime,\n data: {\n ...request.data,\n success,\n ...(errorName ? { errorName } : {}),\n },\n };\n const onTraceError = (traceError: unknown): void => {\n traceLogger('Failed to emit trace', {\n traceName: request.name,\n traceError,\n });\n };\n\n try {\n Promise.resolve(this.#trace(traceRequest, () => undefined)).catch(\n onTraceError,\n );\n } catch (traceError) {\n onTraceError(traceError);\n }\n }\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { Infer } from '@metamask/superstruct';
2
- import type { HistoryResponseStruct, InterestResponseStruct, PositionResponseStruct, RateHistoryResponseStruct, VaultRateResponseStruct, VbaSiweChallengeResponseStruct, VbaSiweSessionResponseStruct, VbaTransfersResponseStruct } from './structs.js';
2
+ import type { HistoryResponseStruct, InterestResponseStruct, PositionResponseStruct, RateHistoryResponseStruct, VaultRateResponseStruct, VaultShareValuationsResponseStruct, VbaSiweChallengeResponseStruct, VbaSiweSessionResponseStruct, VbaTransfersResponseStruct } from './structs.js';
3
3
  /**
4
4
  * Data freshness indicator returned by all business endpoints.
5
5
  */
@@ -127,6 +127,39 @@ export type RateHistoryResponse = Infer<typeof RateHistoryResponseStruct>;
127
127
  * (assets per share). `timestamp` is when that rate was indexed.
128
128
  */
129
129
  export type VaultRateResponse = Infer<typeof VaultRateResponseStruct>;
130
+ /**
131
+ * One vault share movement in a past transaction, valued in the vault's
132
+ * underlying asset at that block.
133
+ */
134
+ export type VaultShareValuation = {
135
+ vault_address: string;
136
+ vault_key: string;
137
+ asset_symbol: string;
138
+ asset_decimals: number;
139
+ type: CashFlowType;
140
+ log_index: number;
141
+ block_number: number;
142
+ timestamp: string;
143
+ shares_wei: string;
144
+ assets_wei: string;
145
+ rate: string;
146
+ source: CashFlowSource;
147
+ };
148
+ /**
149
+ * Valuations for one requested transaction hash. `found` is false when no
150
+ * vault cash flow for the user is indexed for the transaction.
151
+ */
152
+ export type VaultShareValuationResult = {
153
+ tx_hash: string;
154
+ found: boolean;
155
+ valuations: VaultShareValuation[];
156
+ };
157
+ /**
158
+ * Response from `GET /v1/positions/:address/vault-share-valuations`.
159
+ * Derived from {@link VaultShareValuationsResponseStruct} to ensure
160
+ * type/struct parity.
161
+ */
162
+ export type VaultShareValuationsResponse = Infer<typeof VaultShareValuationsResponseStruct>;
130
163
  /** Response from the SIWE challenge endpoint. */
131
164
  export type VbaSiweChallengeResponse = Infer<typeof VbaSiweChallengeResponseStruct>;
132
165
  /** Response from the SIWE session verification endpoint. */
@@ -1 +1 @@
1
- {"version":3,"file":"response.types.d.ts","sourceRoot":"","sources":["../src/response.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EACvB,8BAA8B,EAC9B,4BAA4B,EAC5B,0BAA0B,EAC3B,MAAM,cAAc,CAAC;AAMtB;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,UAAU,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,qFAAqF;IACrF,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,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G,oBAAoB,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,6CAA6C;AAC7C,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"response.types.js","sourceRoot":"","sources":["../src/response.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Infer } from '@metamask/superstruct';\n\nimport type {\n HistoryResponseStruct,\n InterestResponseStruct,\n PositionResponseStruct,\n RateHistoryResponseStruct,\n VaultRateResponseStruct,\n VbaSiweChallengeResponseStruct,\n VbaSiweSessionResponseStruct,\n VbaTransfersResponseStruct,\n} from './structs.js';\n\n// All types in this file mirror the external Money Account API's snake_case\n// JSON contract verbatim to maintain 1:1 parity with API responses.\n/* eslint-disable @typescript-eslint/naming-convention */\n\n/**\n * Data freshness indicator returned by all business endpoints.\n */\nexport type DataFreshness = 'live' | 'degraded';\n\n/**\n * A single vault position within the positions response.\n */\nexport type VaultPosition = {\n chain_id: number;\n /** Stable vault identity within the environment, such as `standard` or `premium`. */\n vault_key: string;\n name: string;\n asset_symbol: string;\n /** Decimal exponent of the underlying asset. */\n asset_decimals: number;\n vault_address: string;\n shares_held: string;\n current_rate: string;\n current_value_assets: string;\n current_value_usd: string;\n cost_basis_assets: string;\n cost_basis_usd: string;\n realized_interest_usd: string;\n unrealised_interest_usd: string;\n lifetime_interest_usd: string;\n current_apy: string;\n /**\n * Realised money-weighted annual return.\n * `null` means the position has been invested for fewer than 28 days.\n */\n effective_apy: string | null;\n};\n\n/**\n * One underlying asset in the positions balance breakdown.\n */\nexport type AssetBalance = {\n asset_contract_address: string;\n asset_symbol: string;\n asset_decimals: number;\n /** Liquid wallet balance of this asset, in smallest units. */\n wallet_balance: string;\n /** Vault positions denominated in this asset, in smallest units. */\n vault_value: string;\n /** `wallet_balance` + `vault_value`, in smallest units of this asset. */\n total: string;\n /** USD value of `total`. */\n total_usd: string;\n};\n\n/**\n * Balance summary on the positions response.\n * `null` when the API's wallet-balance path is disabled or unavailable.\n *\n * `musd_balance`, `vmusd_value_in_musd`, and `total_balance` are mUSD-only.\n * Prefer `by_asset` and `total_balance_usd` for a multi-asset portfolio.\n */\nexport type PositionBalance = {\n musd_balance: string;\n vmusd_value_in_musd: string;\n total_balance: string;\n /** ISO-8601 timestamp of the last wallet mUSD observation, when provided. */\n musd_balance_updated_at?: string | null;\n by_asset: AssetBalance[];\n /** Total across every asset, normalised to USD. */\n total_balance_usd: string;\n};\n\n/**\n * Response from `GET /v1/positions/:address`.\n * Derived from {@link PositionResponseStruct} to ensure type/struct parity.\n */\nexport type PositionResponse = Infer<typeof PositionResponseStruct>;\n\n/**\n * Response from `GET /v1/positions/:address/interest`.\n * Derived from {@link InterestResponseStruct} to ensure type/struct parity.\n */\nexport type InterestResponse = Infer<typeof InterestResponseStruct>;\n\n/**\n * Cash-flow type for the history endpoint.\n */\nexport type CashFlowType =\n | 'deposit'\n | 'withdraw'\n | 'transfer_in'\n | 'transfer_out';\n\n/**\n * Cash-flow source label.\n */\nexport type CashFlowSource =\n | 'teller'\n | 'withdraw_queue'\n | 'atomic_queue'\n | 'erc20_transfer'\n | 'cross_chain';\n\n/**\n * A single entry in the cash-flow history.\n */\nexport type CashFlowEntry = {\n type: CashFlowType;\n chain_id: number;\n vault_address: string;\n timestamp: string;\n block_number: number;\n log_index: number;\n tx_hash: string;\n assets_usd: string;\n assets_wei: string;\n shares_wei: string;\n rate: string;\n source: CashFlowSource;\n};\n\n/**\n * Response from `GET /v1/positions/:address/history`.\n * Derived from {@link HistoryResponseStruct} to ensure type/struct parity.\n */\nexport type HistoryResponse = Infer<typeof HistoryResponseStruct>;\n\n/**\n * A single entry in the rate-history time series.\n */\nexport type RateHistoryEntry = {\n timestamp: string;\n block_number: number;\n rate: string;\n tx_hash: string;\n};\n\n/**\n * Response from `GET /v1/vaults/:address/rate-history`.\n * Derived from {@link RateHistoryResponseStruct} to ensure type/struct parity.\n */\nexport type RateHistoryResponse = Infer<typeof RateHistoryResponseStruct>;\n\n/**\n * Response from `GET /v1/vaults/:address/rate`.\n * Derived from {@link VaultRateResponseStruct} to ensure type/struct parity.\n *\n * `rate` is the latest Accountant exchange rate as an 18-decimal string\n * (assets per share). `timestamp` is when that rate was indexed.\n */\nexport type VaultRateResponse = Infer<typeof VaultRateResponseStruct>;\n\n/** Response from the SIWE challenge endpoint. */\nexport type VbaSiweChallengeResponse = Infer<\n typeof VbaSiweChallengeResponseStruct\n>;\n\n/** Response from the SIWE session verification endpoint. */\nexport type VbaSiweSessionResponse = Infer<typeof VbaSiweSessionResponseStruct>;\n\n/** One current VBA transfer returned for the authenticated wallet. */\nexport type VbaTransfer = VbaTransfersResponse['transfers'][number];\n\n/** Response from `GET /v1/vba/transfers`. */\nexport type VbaTransfersResponse = Infer<typeof VbaTransfersResponseStruct>;\n"]}
1
+ {"version":3,"file":"response.types.js","sourceRoot":"","sources":["../src/response.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Infer } from '@metamask/superstruct';\n\nimport type {\n HistoryResponseStruct,\n InterestResponseStruct,\n PositionResponseStruct,\n RateHistoryResponseStruct,\n VaultRateResponseStruct,\n VaultShareValuationsResponseStruct,\n VbaSiweChallengeResponseStruct,\n VbaSiweSessionResponseStruct,\n VbaTransfersResponseStruct,\n} from './structs.js';\n\n// All types in this file mirror the external Money Account API's snake_case\n// JSON contract verbatim to maintain 1:1 parity with API responses.\n/* eslint-disable @typescript-eslint/naming-convention */\n\n/**\n * Data freshness indicator returned by all business endpoints.\n */\nexport type DataFreshness = 'live' | 'degraded';\n\n/**\n * A single vault position within the positions response.\n */\nexport type VaultPosition = {\n chain_id: number;\n /** Stable vault identity within the environment, such as `standard` or `premium`. */\n vault_key: string;\n name: string;\n asset_symbol: string;\n /** Decimal exponent of the underlying asset. */\n asset_decimals: number;\n vault_address: string;\n shares_held: string;\n current_rate: string;\n current_value_assets: string;\n current_value_usd: string;\n cost_basis_assets: string;\n cost_basis_usd: string;\n realized_interest_usd: string;\n unrealised_interest_usd: string;\n lifetime_interest_usd: string;\n current_apy: string;\n /**\n * Realised money-weighted annual return.\n * `null` means the position has been invested for fewer than 28 days.\n */\n effective_apy: string | null;\n};\n\n/**\n * One underlying asset in the positions balance breakdown.\n */\nexport type AssetBalance = {\n asset_contract_address: string;\n asset_symbol: string;\n asset_decimals: number;\n /** Liquid wallet balance of this asset, in smallest units. */\n wallet_balance: string;\n /** Vault positions denominated in this asset, in smallest units. */\n vault_value: string;\n /** `wallet_balance` + `vault_value`, in smallest units of this asset. */\n total: string;\n /** USD value of `total`. */\n total_usd: string;\n};\n\n/**\n * Balance summary on the positions response.\n * `null` when the API's wallet-balance path is disabled or unavailable.\n *\n * `musd_balance`, `vmusd_value_in_musd`, and `total_balance` are mUSD-only.\n * Prefer `by_asset` and `total_balance_usd` for a multi-asset portfolio.\n */\nexport type PositionBalance = {\n musd_balance: string;\n vmusd_value_in_musd: string;\n total_balance: string;\n /** ISO-8601 timestamp of the last wallet mUSD observation, when provided. */\n musd_balance_updated_at?: string | null;\n by_asset: AssetBalance[];\n /** Total across every asset, normalised to USD. */\n total_balance_usd: string;\n};\n\n/**\n * Response from `GET /v1/positions/:address`.\n * Derived from {@link PositionResponseStruct} to ensure type/struct parity.\n */\nexport type PositionResponse = Infer<typeof PositionResponseStruct>;\n\n/**\n * Response from `GET /v1/positions/:address/interest`.\n * Derived from {@link InterestResponseStruct} to ensure type/struct parity.\n */\nexport type InterestResponse = Infer<typeof InterestResponseStruct>;\n\n/**\n * Cash-flow type for the history endpoint.\n */\nexport type CashFlowType =\n | 'deposit'\n | 'withdraw'\n | 'transfer_in'\n | 'transfer_out';\n\n/**\n * Cash-flow source label.\n */\nexport type CashFlowSource =\n | 'teller'\n | 'withdraw_queue'\n | 'atomic_queue'\n | 'erc20_transfer'\n | 'cross_chain';\n\n/**\n * A single entry in the cash-flow history.\n */\nexport type CashFlowEntry = {\n type: CashFlowType;\n chain_id: number;\n vault_address: string;\n timestamp: string;\n block_number: number;\n log_index: number;\n tx_hash: string;\n assets_usd: string;\n assets_wei: string;\n shares_wei: string;\n rate: string;\n source: CashFlowSource;\n};\n\n/**\n * Response from `GET /v1/positions/:address/history`.\n * Derived from {@link HistoryResponseStruct} to ensure type/struct parity.\n */\nexport type HistoryResponse = Infer<typeof HistoryResponseStruct>;\n\n/**\n * A single entry in the rate-history time series.\n */\nexport type RateHistoryEntry = {\n timestamp: string;\n block_number: number;\n rate: string;\n tx_hash: string;\n};\n\n/**\n * Response from `GET /v1/vaults/:address/rate-history`.\n * Derived from {@link RateHistoryResponseStruct} to ensure type/struct parity.\n */\nexport type RateHistoryResponse = Infer<typeof RateHistoryResponseStruct>;\n\n/**\n * Response from `GET /v1/vaults/:address/rate`.\n * Derived from {@link VaultRateResponseStruct} to ensure type/struct parity.\n *\n * `rate` is the latest Accountant exchange rate as an 18-decimal string\n * (assets per share). `timestamp` is when that rate was indexed.\n */\nexport type VaultRateResponse = Infer<typeof VaultRateResponseStruct>;\n\n/**\n * One vault share movement in a past transaction, valued in the vault's\n * underlying asset at that block.\n */\nexport type VaultShareValuation = {\n vault_address: string;\n vault_key: string;\n asset_symbol: string;\n asset_decimals: number;\n type: CashFlowType;\n log_index: number;\n block_number: number;\n timestamp: string;\n shares_wei: string;\n assets_wei: string;\n rate: string;\n source: CashFlowSource;\n};\n\n/**\n * Valuations for one requested transaction hash. `found` is false when no\n * vault cash flow for the user is indexed for the transaction.\n */\nexport type VaultShareValuationResult = {\n tx_hash: string;\n found: boolean;\n valuations: VaultShareValuation[];\n};\n\n/**\n * Response from `GET /v1/positions/:address/vault-share-valuations`.\n * Derived from {@link VaultShareValuationsResponseStruct} to ensure\n * type/struct parity.\n */\nexport type VaultShareValuationsResponse = Infer<\n typeof VaultShareValuationsResponseStruct\n>;\n\n/** Response from the SIWE challenge endpoint. */\nexport type VbaSiweChallengeResponse = Infer<\n typeof VbaSiweChallengeResponseStruct\n>;\n\n/** Response from the SIWE session verification endpoint. */\nexport type VbaSiweSessionResponse = Infer<typeof VbaSiweSessionResponseStruct>;\n\n/** One current VBA transfer returned for the authenticated wallet. */\nexport type VbaTransfer = VbaTransfersResponse['transfers'][number];\n\n/** Response from `GET /v1/vba/transfers`. */\nexport type VbaTransfersResponse = Infer<typeof VbaTransfersResponseStruct>;\n"]}
package/dist/structs.d.ts CHANGED
@@ -332,6 +332,131 @@ export declare const VaultRateResponseStruct: import("@metamask/superstruct").St
332
332
  }>;
333
333
  indexer_lag_seconds: import("@metamask/superstruct").Struct<number, null>;
334
334
  }>;
335
+ export declare const VaultShareValuationsResponseStruct: import("@metamask/superstruct").Struct<{
336
+ address: string;
337
+ chain_id: number;
338
+ results: {
339
+ tx_hash: string;
340
+ found: boolean;
341
+ valuations: {
342
+ vault_address: string;
343
+ vault_key: string;
344
+ asset_symbol: string;
345
+ asset_decimals: number;
346
+ type: "deposit" | "transfer_in" | "transfer_out" | "withdraw";
347
+ log_index: number;
348
+ block_number: number;
349
+ timestamp: string;
350
+ shares_wei: string;
351
+ assets_wei: string;
352
+ rate: string;
353
+ source: "atomic_queue" | "cross_chain" | "erc20_transfer" | "teller" | "withdraw_queue";
354
+ }[];
355
+ }[];
356
+ as_of_block: number;
357
+ as_of_timestamp: string;
358
+ data_freshness: "degraded" | "live";
359
+ indexer_lag_seconds: number;
360
+ }, {
361
+ address: import("@metamask/superstruct").Struct<string, null>;
362
+ chain_id: import("@metamask/superstruct").Struct<number, null>;
363
+ results: import("@metamask/superstruct").Struct<{
364
+ tx_hash: string;
365
+ found: boolean;
366
+ valuations: {
367
+ vault_address: string;
368
+ vault_key: string;
369
+ asset_symbol: string;
370
+ asset_decimals: number;
371
+ type: "deposit" | "transfer_in" | "transfer_out" | "withdraw";
372
+ log_index: number;
373
+ block_number: number;
374
+ timestamp: string;
375
+ shares_wei: string;
376
+ assets_wei: string;
377
+ rate: string;
378
+ source: "atomic_queue" | "cross_chain" | "erc20_transfer" | "teller" | "withdraw_queue";
379
+ }[];
380
+ }[], import("@metamask/superstruct").Struct<{
381
+ tx_hash: string;
382
+ found: boolean;
383
+ valuations: {
384
+ vault_address: string;
385
+ vault_key: string;
386
+ asset_symbol: string;
387
+ asset_decimals: number;
388
+ type: "deposit" | "transfer_in" | "transfer_out" | "withdraw";
389
+ log_index: number;
390
+ block_number: number;
391
+ timestamp: string;
392
+ shares_wei: string;
393
+ assets_wei: string;
394
+ rate: string;
395
+ source: "atomic_queue" | "cross_chain" | "erc20_transfer" | "teller" | "withdraw_queue";
396
+ }[];
397
+ }, {
398
+ tx_hash: import("@metamask/superstruct").Struct<string, null>;
399
+ found: import("@metamask/superstruct").Struct<boolean, null>;
400
+ valuations: import("@metamask/superstruct").Struct<{
401
+ vault_address: string;
402
+ vault_key: string;
403
+ asset_symbol: string;
404
+ asset_decimals: number;
405
+ type: "deposit" | "transfer_in" | "transfer_out" | "withdraw";
406
+ log_index: number;
407
+ block_number: number;
408
+ timestamp: string;
409
+ shares_wei: string;
410
+ assets_wei: string;
411
+ rate: string;
412
+ source: "atomic_queue" | "cross_chain" | "erc20_transfer" | "teller" | "withdraw_queue";
413
+ }[], import("@metamask/superstruct").Struct<{
414
+ vault_address: string;
415
+ vault_key: string;
416
+ asset_symbol: string;
417
+ asset_decimals: number;
418
+ type: "deposit" | "transfer_in" | "transfer_out" | "withdraw";
419
+ log_index: number;
420
+ block_number: number;
421
+ timestamp: string;
422
+ shares_wei: string;
423
+ assets_wei: string;
424
+ rate: string;
425
+ source: "atomic_queue" | "cross_chain" | "erc20_transfer" | "teller" | "withdraw_queue";
426
+ }, {
427
+ vault_address: import("@metamask/superstruct").Struct<string, null>;
428
+ vault_key: import("@metamask/superstruct").Struct<string, null>;
429
+ asset_symbol: import("@metamask/superstruct").Struct<string, null>;
430
+ asset_decimals: import("@metamask/superstruct").Struct<number, null>;
431
+ type: import("@metamask/superstruct").Struct<"deposit" | "transfer_in" | "transfer_out" | "withdraw", {
432
+ deposit: "deposit";
433
+ transfer_in: "transfer_in";
434
+ transfer_out: "transfer_out";
435
+ withdraw: "withdraw";
436
+ }>;
437
+ log_index: import("@metamask/superstruct").Struct<number, null>;
438
+ block_number: import("@metamask/superstruct").Struct<number, null>;
439
+ timestamp: import("@metamask/superstruct").Struct<string, null>;
440
+ shares_wei: import("@metamask/superstruct").Struct<string, null>;
441
+ assets_wei: import("@metamask/superstruct").Struct<string, null>;
442
+ rate: import("@metamask/superstruct").Struct<string, null>;
443
+ source: import("@metamask/superstruct").Struct<"atomic_queue" | "cross_chain" | "erc20_transfer" | "teller" | "withdraw_queue", {
444
+ atomic_queue: "atomic_queue";
445
+ cross_chain: "cross_chain";
446
+ erc20_transfer: "erc20_transfer";
447
+ teller: "teller";
448
+ withdraw_queue: "withdraw_queue";
449
+ }>;
450
+ }>>;
451
+ }>>;
452
+ as_of_block: import("@metamask/superstruct").Struct<number, null>;
453
+ as_of_timestamp: import("@metamask/superstruct").Struct<string, null>;
454
+ data_freshness: import("@metamask/superstruct").Struct<"degraded" | "live", {
455
+ degraded: "degraded";
456
+ live: "live";
457
+ }>;
458
+ indexer_lag_seconds: import("@metamask/superstruct").Struct<number, null>;
459
+ }>;
335
460
  export declare const VbaSiweChallengeResponseStruct: import("@metamask/superstruct").Struct<{
336
461
  nonce: string;
337
462
  message: string;
@@ -1 +1 @@
1
- {"version":3,"file":"structs.d.ts","sourceRoot":"","sources":["../src/structs.ts"],"names":[],"mappings":"AAoEA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUjC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAajC,CAAC;AAuBH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;EAQ7C,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;EAGzC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;EAIvC,CAAC;AAoBH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAErC,CAAC"}
package/dist/structs.js CHANGED
@@ -133,6 +133,40 @@ export const VaultRateResponseStruct = type({
133
133
  data_freshness: DataFreshnessStruct,
134
134
  indexer_lag_seconds: number(),
135
135
  });
136
+ const VaultShareValuationStruct = type({
137
+ vault_address: string(),
138
+ vault_key: string(),
139
+ asset_symbol: string(),
140
+ asset_decimals: number(),
141
+ type: enums(['deposit', 'withdraw', 'transfer_in', 'transfer_out']),
142
+ log_index: number(),
143
+ block_number: number(),
144
+ timestamp: string(),
145
+ shares_wei: string(),
146
+ assets_wei: string(),
147
+ rate: string(),
148
+ source: enums([
149
+ 'teller',
150
+ 'withdraw_queue',
151
+ 'atomic_queue',
152
+ 'erc20_transfer',
153
+ 'cross_chain',
154
+ ]),
155
+ });
156
+ const VaultShareValuationResultStruct = type({
157
+ tx_hash: string(),
158
+ found: boolean(),
159
+ valuations: array(VaultShareValuationStruct),
160
+ });
161
+ export const VaultShareValuationsResponseStruct = type({
162
+ address: string(),
163
+ chain_id: number(),
164
+ results: array(VaultShareValuationResultStruct),
165
+ as_of_block: number(),
166
+ as_of_timestamp: string(),
167
+ data_freshness: DataFreshnessStruct,
168
+ indexer_lag_seconds: number(),
169
+ });
136
170
  export const VbaSiweChallengeResponseStruct = type({
137
171
  nonce: string(),
138
172
  message: string(),
@@ -1 +1 @@
1
- {"version":3,"file":"structs.js","sourceRoot":"","sources":["../src/structs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,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":["import {\n array,\n boolean,\n enums,\n nullable,\n number,\n optional,\n string,\n type,\n} from '@metamask/superstruct';\n\n// Every schema here uses `type()` rather than `object()` so that fields the\n// Money Account API adds later pass validation instead of throwing. Additive\n// backend changes should not be breaking changes for clients.\n\nconst DataFreshnessStruct = enums(['live', 'degraded']);\n\nconst VaultPositionStruct = type({\n chain_id: number(),\n vault_key: string(),\n name: string(),\n asset_symbol: string(),\n asset_decimals: number(),\n vault_address: string(),\n shares_held: string(),\n current_rate: string(),\n current_value_assets: string(),\n current_value_usd: string(),\n cost_basis_assets: string(),\n cost_basis_usd: string(),\n realized_interest_usd: string(),\n unrealised_interest_usd: string(),\n lifetime_interest_usd: string(),\n current_apy: string(),\n // `null` means the position has been invested for fewer than 28 days.\n effective_apy: nullable(string()),\n});\n\n/**\n * One underlying asset in the positions balance breakdown.\n */\nconst AssetBalanceStruct = type({\n asset_contract_address: string(),\n asset_symbol: string(),\n asset_decimals: number(),\n wallet_balance: string(),\n vault_value: string(),\n total: string(),\n total_usd: string(),\n});\n\n/**\n * Wallet + vault balance summary on the positions response.\n * `null` when the API's wallet-balance path is disabled or unavailable.\n *\n * `musd_balance`, `vmusd_value_in_musd`, and `total_balance` are mUSD-only\n * and deprecated on the API in favor of `by_asset` and `total_balance_usd`.\n */\nconst PositionBalanceStruct = type({\n musd_balance: string(),\n vmusd_value_in_musd: string(),\n total_balance: string(),\n // Additive — older API builds omit this field.\n musd_balance_updated_at: optional(nullable(string())),\n by_asset: array(AssetBalanceStruct),\n total_balance_usd: string(),\n});\n\nexport const PositionResponseStruct = type({\n address: string(),\n as_of_block: number(),\n as_of_timestamp: string(),\n data_freshness: DataFreshnessStruct,\n indexer_lag_seconds: number(),\n // Optional for backwards compatibility with responses that omit the field;\n // when present, may be `null` if the API balance flag is off.\n balance: optional(nullable(PositionBalanceStruct)),\n positions: array(VaultPositionStruct),\n});\n\nexport const InterestResponseStruct = type({\n address: string(),\n vault_address: string(),\n window: string(),\n window_start: string(),\n window_end: string(),\n interest_earned_assets: string(),\n interest_earned_usd: string(),\n method: string(),\n as_of_block: number(),\n as_of_timestamp: string(),\n data_freshness: DataFreshnessStruct,\n indexer_lag_seconds: number(),\n});\n\nconst CashFlowEntryStruct = type({\n type: enums(['deposit', 'withdraw', 'transfer_in', 'transfer_out']),\n chain_id: number(),\n vault_address: string(),\n timestamp: string(),\n block_number: number(),\n log_index: number(),\n tx_hash: string(),\n assets_usd: string(),\n assets_wei: string(),\n shares_wei: string(),\n rate: string(),\n source: enums([\n 'teller',\n 'withdraw_queue',\n 'atomic_queue',\n 'erc20_transfer',\n 'cross_chain',\n ]),\n});\n\nexport const HistoryResponseStruct = type({\n address: string(),\n cash_flows: array(CashFlowEntryStruct),\n next_cursor: nullable(string()),\n has_more: boolean(),\n as_of_block: number(),\n as_of_timestamp: string(),\n data_freshness: DataFreshnessStruct,\n indexer_lag_seconds: number(),\n});\n\nconst RateHistoryEntryStruct = type({\n timestamp: string(),\n block_number: number(),\n rate: string(),\n tx_hash: string(),\n});\n\nexport const RateHistoryResponseStruct = type({\n vault_address: string(),\n chain_id: number(),\n range_start: string(),\n range_end: string(),\n rates: array(RateHistoryEntryStruct),\n as_of_block: number(),\n as_of_timestamp: string(),\n data_freshness: DataFreshnessStruct,\n indexer_lag_seconds: number(),\n});\n\nexport const VaultRateResponseStruct = type({\n vault_address: string(),\n chain_id: number(),\n rate: string(),\n timestamp: string(),\n as_of_block: number(),\n as_of_timestamp: string(),\n data_freshness: DataFreshnessStruct,\n indexer_lag_seconds: number(),\n});\n\nexport const VbaSiweChallengeResponseStruct = type({\n nonce: string(),\n message: string(),\n});\n\nexport const VbaSiweSessionResponseStruct = type({\n token_type: enums(['bearer']),\n access_token: string(),\n expires_in: number(),\n});\n\nconst VbaTransferDetailsStruct = type({\n sender_address: nullable(string()),\n recipient_address: string(),\n network: string(),\n amount: string(),\n asset: string(),\n transaction_hash: nullable(string()),\n});\n\nconst VbaTransferStruct = type({\n event_id: string(),\n transfer_id: string(),\n status: enums(['processing', 'confirmed', 'error']),\n event_timestamp: string(),\n updated_at: string(),\n transfer: VbaTransferDetailsStruct,\n});\n\nexport const VbaTransfersResponseStruct = type({\n transfers: array(VbaTransferStruct),\n});\n"]}
1
+ {"version":3,"file":"structs.js","sourceRoot":"","sources":["../src/structs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,GACL,MAAM,uBAAuB,CAAC;AAE/B,4EAA4E;AAC5E,6EAA6E;AAC7E,8DAA8D;AAE9D,MAAM,mBAAmB,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AAExD,MAAM,mBAAmB,GAAG,IAAI,CAAC;IAC/B,QAAQ,EAAE,MAAM,EAAE;IAClB,SAAS,EAAE,MAAM,EAAE;IACnB,IAAI,EAAE,MAAM,EAAE;IACd,YAAY,EAAE,MAAM,EAAE;IACtB,cAAc,EAAE,MAAM,EAAE;IACxB,aAAa,EAAE,MAAM,EAAE;IACvB,WAAW,EAAE,MAAM,EAAE;IACrB,YAAY,EAAE,MAAM,EAAE;IACtB,oBAAoB,EAAE,MAAM,EAAE;IAC9B,iBAAiB,EAAE,MAAM,EAAE;IAC3B,iBAAiB,EAAE,MAAM,EAAE;IAC3B,cAAc,EAAE,MAAM,EAAE;IACxB,qBAAqB,EAAE,MAAM,EAAE;IAC/B,uBAAuB,EAAE,MAAM,EAAE;IACjC,qBAAqB,EAAE,MAAM,EAAE;IAC/B,WAAW,EAAE,MAAM,EAAE;IACrB,sEAAsE;IACtE,aAAa,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CAClC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,kBAAkB,GAAG,IAAI,CAAC;IAC9B,sBAAsB,EAAE,MAAM,EAAE;IAChC,YAAY,EAAE,MAAM,EAAE;IACtB,cAAc,EAAE,MAAM,EAAE;IACxB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IAAI,CAAC;IAC7C,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC;CACpC,CAAC,CAAC","sourcesContent":["import {\n array,\n boolean,\n enums,\n nullable,\n number,\n optional,\n string,\n type,\n} from '@metamask/superstruct';\n\n// Every schema here uses `type()` rather than `object()` so that fields the\n// Money Account API adds later pass validation instead of throwing. Additive\n// backend changes should not be breaking changes for clients.\n\nconst DataFreshnessStruct = enums(['live', 'degraded']);\n\nconst VaultPositionStruct = type({\n chain_id: number(),\n vault_key: string(),\n name: string(),\n asset_symbol: string(),\n asset_decimals: number(),\n vault_address: string(),\n shares_held: string(),\n current_rate: string(),\n current_value_assets: string(),\n current_value_usd: string(),\n cost_basis_assets: string(),\n cost_basis_usd: string(),\n realized_interest_usd: string(),\n unrealised_interest_usd: string(),\n lifetime_interest_usd: string(),\n current_apy: string(),\n // `null` means the position has been invested for fewer than 28 days.\n effective_apy: nullable(string()),\n});\n\n/**\n * One underlying asset in the positions balance breakdown.\n */\nconst AssetBalanceStruct = type({\n asset_contract_address: string(),\n asset_symbol: string(),\n asset_decimals: number(),\n wallet_balance: string(),\n vault_value: string(),\n total: string(),\n total_usd: string(),\n});\n\n/**\n * Wallet + vault balance summary on the positions response.\n * `null` when the API's wallet-balance path is disabled or unavailable.\n *\n * `musd_balance`, `vmusd_value_in_musd`, and `total_balance` are mUSD-only\n * and deprecated on the API in favor of `by_asset` and `total_balance_usd`.\n */\nconst PositionBalanceStruct = type({\n musd_balance: string(),\n vmusd_value_in_musd: string(),\n total_balance: string(),\n // Additive — older API builds omit this field.\n musd_balance_updated_at: optional(nullable(string())),\n by_asset: array(AssetBalanceStruct),\n total_balance_usd: string(),\n});\n\nexport const PositionResponseStruct = type({\n address: string(),\n as_of_block: number(),\n as_of_timestamp: string(),\n data_freshness: DataFreshnessStruct,\n indexer_lag_seconds: number(),\n // Optional for backwards compatibility with responses that omit the field;\n // when present, may be `null` if the API balance flag is off.\n balance: optional(nullable(PositionBalanceStruct)),\n positions: array(VaultPositionStruct),\n});\n\nexport const InterestResponseStruct = type({\n address: string(),\n vault_address: string(),\n window: string(),\n window_start: string(),\n window_end: string(),\n interest_earned_assets: string(),\n interest_earned_usd: string(),\n method: string(),\n as_of_block: number(),\n as_of_timestamp: string(),\n data_freshness: DataFreshnessStruct,\n indexer_lag_seconds: number(),\n});\n\nconst CashFlowEntryStruct = type({\n type: enums(['deposit', 'withdraw', 'transfer_in', 'transfer_out']),\n chain_id: number(),\n vault_address: string(),\n timestamp: string(),\n block_number: number(),\n log_index: number(),\n tx_hash: string(),\n assets_usd: string(),\n assets_wei: string(),\n shares_wei: string(),\n rate: string(),\n source: enums([\n 'teller',\n 'withdraw_queue',\n 'atomic_queue',\n 'erc20_transfer',\n 'cross_chain',\n ]),\n});\n\nexport const HistoryResponseStruct = type({\n address: string(),\n cash_flows: array(CashFlowEntryStruct),\n next_cursor: nullable(string()),\n has_more: boolean(),\n as_of_block: number(),\n as_of_timestamp: string(),\n data_freshness: DataFreshnessStruct,\n indexer_lag_seconds: number(),\n});\n\nconst RateHistoryEntryStruct = type({\n timestamp: string(),\n block_number: number(),\n rate: string(),\n tx_hash: string(),\n});\n\nexport const RateHistoryResponseStruct = type({\n vault_address: string(),\n chain_id: number(),\n range_start: string(),\n range_end: string(),\n rates: array(RateHistoryEntryStruct),\n as_of_block: number(),\n as_of_timestamp: string(),\n data_freshness: DataFreshnessStruct,\n indexer_lag_seconds: number(),\n});\n\nexport const VaultRateResponseStruct = type({\n vault_address: string(),\n chain_id: number(),\n rate: string(),\n timestamp: string(),\n as_of_block: number(),\n as_of_timestamp: string(),\n data_freshness: DataFreshnessStruct,\n indexer_lag_seconds: number(),\n});\n\nconst VaultShareValuationStruct = type({\n vault_address: string(),\n vault_key: string(),\n asset_symbol: string(),\n asset_decimals: number(),\n type: enums(['deposit', 'withdraw', 'transfer_in', 'transfer_out']),\n log_index: number(),\n block_number: number(),\n timestamp: string(),\n shares_wei: string(),\n assets_wei: string(),\n rate: string(),\n source: enums([\n 'teller',\n 'withdraw_queue',\n 'atomic_queue',\n 'erc20_transfer',\n 'cross_chain',\n ]),\n});\n\nconst VaultShareValuationResultStruct = type({\n tx_hash: string(),\n found: boolean(),\n valuations: array(VaultShareValuationStruct),\n});\n\nexport const VaultShareValuationsResponseStruct = type({\n address: string(),\n chain_id: number(),\n results: array(VaultShareValuationResultStruct),\n as_of_block: number(),\n as_of_timestamp: string(),\n data_freshness: DataFreshnessStruct,\n indexer_lag_seconds: number(),\n});\n\nexport const VbaSiweChallengeResponseStruct = type({\n nonce: string(),\n message: string(),\n});\n\nexport const VbaSiweSessionResponseStruct = type({\n token_type: enums(['bearer']),\n access_token: string(),\n expires_in: number(),\n});\n\nconst VbaTransferDetailsStruct = type({\n sender_address: nullable(string()),\n recipient_address: string(),\n network: string(),\n amount: string(),\n asset: string(),\n transaction_hash: nullable(string()),\n});\n\nconst VbaTransferStruct = type({\n event_id: string(),\n transfer_id: string(),\n status: enums(['processing', 'confirmed', 'error']),\n event_timestamp: string(),\n updated_at: string(),\n transfer: VbaTransferDetailsStruct,\n});\n\nexport const VbaTransfersResponseStruct = type({\n transfers: array(VbaTransferStruct),\n});\n"]}
package/dist/types.d.ts CHANGED
@@ -46,6 +46,17 @@ export type RateHistoryOptions = {
46
46
  export type VaultRateOptions = {
47
47
  chainId?: number;
48
48
  };
49
+ /**
50
+ * Options for the `fetchVaultShareValuations` method.
51
+ */
52
+ export type VaultShareValuationsOptions = {
53
+ /**
54
+ * Transaction hashes to value. At most 50 distinct hashes after lowercasing
55
+ * and de-duplication.
56
+ */
57
+ txHashes: string[];
58
+ chainId?: number;
59
+ };
49
60
  /** Options for the SIWE-authenticated current VBA transfer read. */
50
61
  export type FetchVbaTransfersOptions = {
51
62
  /** Address whose SIWE session is used to authorize the request. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAA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BAAqB,GAAG;IAClC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC;;;OAGG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,oEAAoE;AACpE,MAAM,MAAM,wBAAwB,GAAG;IACrC,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Valid time-window values for the interest endpoint.\n */\nexport type InterestWindow = '24h' | '7d' | '30d' | 'ytd' | 'since_inception';\n\n/**\n * Options for the `fetchInterest` method.\n */\nexport type InterestOptions = {\n vaultAddress: string;\n window: InterestWindow;\n chainId?: number;\n};\n\n/**\n * Options for the `fetchPositions` method.\n */\nexport type FetchPositionsOptions = {\n /**\n * When true, cancel an in-flight read, fetch with a zero stale time,\n * invalidate the result for subsequent reads, and send\n * `Cache-Control: no-cache` so the Money API also skips its Nest response\n * cache and refreshes the wallet mUSD balance on demand. Intended for\n * post-transaction read-your-writes refreshes.\n */\n fresh?: boolean;\n};\n\n/**\n * Options for the `fetchHistory` method.\n */\nexport type HistoryOptions = {\n vaultAddress?: string;\n chainId?: number;\n cursor?: string;\n limit?: number;\n};\n\n/**\n * Options for the `fetchRateHistory` method.\n */\nexport type RateHistoryOptions = {\n chainId?: number;\n from?: string;\n to?: string;\n};\n\n/**\n * Options for the `fetchVaultRate` method.\n */\nexport type VaultRateOptions = {\n chainId?: number;\n};\n\n/** Options for the SIWE-authenticated current VBA transfer read. */\nexport type FetchVbaTransfersOptions = {\n /** Address whose SIWE session is used to authorize the request. */\n address: string;\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Valid time-window values for the interest endpoint.\n */\nexport type InterestWindow = '24h' | '7d' | '30d' | 'ytd' | 'since_inception';\n\n/**\n * Options for the `fetchInterest` method.\n */\nexport type InterestOptions = {\n vaultAddress: string;\n window: InterestWindow;\n chainId?: number;\n};\n\n/**\n * Options for the `fetchPositions` method.\n */\nexport type FetchPositionsOptions = {\n /**\n * When true, cancel an in-flight read, fetch with a zero stale time,\n * invalidate the result for subsequent reads, and send\n * `Cache-Control: no-cache` so the Money API also skips its Nest response\n * cache and refreshes the wallet mUSD balance on demand. Intended for\n * post-transaction read-your-writes refreshes.\n */\n fresh?: boolean;\n};\n\n/**\n * Options for the `fetchHistory` method.\n */\nexport type HistoryOptions = {\n vaultAddress?: string;\n chainId?: number;\n cursor?: string;\n limit?: number;\n};\n\n/**\n * Options for the `fetchRateHistory` method.\n */\nexport type RateHistoryOptions = {\n chainId?: number;\n from?: string;\n to?: string;\n};\n\n/**\n * Options for the `fetchVaultRate` method.\n */\nexport type VaultRateOptions = {\n chainId?: number;\n};\n\n/**\n * Options for the `fetchVaultShareValuations` method.\n */\nexport type VaultShareValuationsOptions = {\n /**\n * Transaction hashes to value. At most 50 distinct hashes after lowercasing\n * and de-duplication.\n */\n txHashes: string[];\n chainId?: number;\n};\n\n/** Options for the SIWE-authenticated current VBA transfer read. */\nexport type FetchVbaTransfersOptions = {\n /** Address whose SIWE session is used to authorize the request. */\n address: string;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/money-account-api-data-service",
3
- "version": "2.3.1-preview-c33f4af3a",
3
+ "version": "2.3.1-preview-e1e83cae0",
4
4
  "description": "Data service for fetching Money account positions, interest, cash-flow history, vault rate history, and the current vault exchange rate from the Money Account API",
5
5
  "keywords": [
6
6
  "Ethereum",