@metamask-previews/money-account-controller 0.1.0-preview-aa31fa3 → 0.1.0-preview-6e596eb

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/dist/money-account-balance-service/requestNormalization.cjs +8 -6
  2. package/dist/money-account-balance-service/requestNormalization.cjs.map +1 -1
  3. package/dist/money-account-balance-service/requestNormalization.d.cts +1 -1
  4. package/dist/money-account-balance-service/requestNormalization.d.cts.map +1 -1
  5. package/dist/money-account-balance-service/requestNormalization.d.mts +1 -1
  6. package/dist/money-account-balance-service/requestNormalization.d.mts.map +1 -1
  7. package/dist/money-account-balance-service/requestNormalization.mjs +8 -6
  8. package/dist/money-account-balance-service/requestNormalization.mjs.map +1 -1
  9. package/dist/money-account-balance-service/response.types.cjs.map +1 -1
  10. package/dist/money-account-balance-service/response.types.d.cts +17 -14
  11. package/dist/money-account-balance-service/response.types.d.cts.map +1 -1
  12. package/dist/money-account-balance-service/response.types.d.mts +17 -14
  13. package/dist/money-account-balance-service/response.types.d.mts.map +1 -1
  14. package/dist/money-account-balance-service/response.types.mjs.map +1 -1
  15. package/dist/money-account-balance-service/structs.cjs +18 -15
  16. package/dist/money-account-balance-service/structs.cjs.map +1 -1
  17. package/dist/money-account-balance-service/structs.d.cts +62 -59
  18. package/dist/money-account-balance-service/structs.d.cts.map +1 -1
  19. package/dist/money-account-balance-service/structs.d.mts +62 -59
  20. package/dist/money-account-balance-service/structs.d.mts.map +1 -1
  21. package/dist/money-account-balance-service/structs.mjs +19 -16
  22. package/dist/money-account-balance-service/structs.mjs.map +1 -1
  23. package/package.json +2 -1
@@ -16,13 +16,15 @@ function normalizeVaultApyResponse(rawResponse) {
16
16
  apy: response.apy,
17
17
  chainAllocation: response.chain_allocation,
18
18
  fees: response.fees,
19
- globalApyBreakdown: {
20
- fee: response.global_apy_breakdown.fee,
21
- maturityApy: response.global_apy_breakdown.maturity_apy,
22
- realApy: response.global_apy_breakdown.real_apy,
23
- },
19
+ globalApyBreakdown: response.global_apy_breakdown
20
+ ? {
21
+ fee: response.global_apy_breakdown.fee,
22
+ maturityApy: response.global_apy_breakdown.maturity_apy,
23
+ realApy: response.global_apy_breakdown.real_apy,
24
+ }
25
+ : undefined,
24
26
  performanceFees: response.performance_fees,
25
- realApyBreakdown: response.real_apy_breakdown.map((item) => ({
27
+ realApyBreakdown: response.real_apy_breakdown?.map((item) => ({
26
28
  allocation: item.allocation,
27
29
  apy: item.apy,
28
30
  apyNet: item.apy_net,
@@ -1 +1 @@
1
- {"version":3,"file":"requestNormalization.cjs","sourceRoot":"","sources":["../../src/money-account-balance-service/requestNormalization.ts"],"names":[],"mappings":";;;AAEA,2CAAmD;AAGnD;;;;;;GAMG;AACH,SAAgB,yBAAyB,CACvC,WAAiD;IAEjD,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC;IAE3C,OAAO;QACL,iBAAiB,EAAE,QAAQ,CAAC,kBAAkB;QAC9C,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,eAAe,EAAE,QAAQ,CAAC,gBAAgB;QAC1C,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,kBAAkB,EAAE;YAClB,GAAG,EAAE,QAAQ,CAAC,oBAAoB,CAAC,GAAG;YACtC,WAAW,EAAE,QAAQ,CAAC,oBAAoB,CAAC,YAAY;YACvD,OAAO,EAAE,QAAQ,CAAC,oBAAoB,CAAC,QAAQ;SAChD;QACD,eAAe,EAAE,QAAQ,CAAC,gBAAgB;QAC1C,gBAAgB,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC3D,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QACH,SAAS,EAAE,QAAQ,CAAC,SAAS;KAC9B,CAAC;AACJ,CAAC;AAzBD,8DAyBC","sourcesContent":["import { Infer } from '@metamask/superstruct';\n\nimport { VaultApyResponseStruct } from './structs';\nimport { VaultApyResponse } from './response.types';\n\n/**\n * Normalizes the raw response from the Veda performance API into the expected\n * format.\n *\n * @param rawResponse - The raw response from the Veda performance API.\n * @returns The normalized response.\n */\nexport function normalizeVaultApyResponse(\n rawResponse: Infer<typeof VaultApyResponseStruct>,\n): VaultApyResponse {\n const { Response: response } = rawResponse;\n\n return {\n aggregationPeriod: response.aggregation_period,\n apy: response.apy,\n chainAllocation: response.chain_allocation,\n fees: response.fees,\n globalApyBreakdown: {\n fee: response.global_apy_breakdown.fee,\n maturityApy: response.global_apy_breakdown.maturity_apy,\n realApy: response.global_apy_breakdown.real_apy,\n },\n performanceFees: response.performance_fees,\n realApyBreakdown: response.real_apy_breakdown.map((item) => ({\n allocation: item.allocation,\n apy: item.apy,\n apyNet: item.apy_net,\n chain: item.chain,\n protocol: item.protocol,\n })),\n timestamp: response.timestamp,\n };\n}\n"]}
1
+ {"version":3,"file":"requestNormalization.cjs","sourceRoot":"","sources":["../../src/money-account-balance-service/requestNormalization.ts"],"names":[],"mappings":";;;AAGA,2CAAmD;AAEnD;;;;;;GAMG;AACH,SAAgB,yBAAyB,CACvC,WAAiD;IAEjD,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC;IAE3C,OAAO;QACL,iBAAiB,EAAE,QAAQ,CAAC,kBAAkB;QAC9C,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,eAAe,EAAE,QAAQ,CAAC,gBAAgB;QAC1C,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,kBAAkB,EAAE,QAAQ,CAAC,oBAAoB;YAC/C,CAAC,CAAC;gBACE,GAAG,EAAE,QAAQ,CAAC,oBAAoB,CAAC,GAAG;gBACtC,WAAW,EAAE,QAAQ,CAAC,oBAAoB,CAAC,YAAY;gBACvD,OAAO,EAAE,QAAQ,CAAC,oBAAoB,CAAC,QAAQ;aAChD;YACH,CAAC,CAAC,SAAS;QACb,eAAe,EAAE,QAAQ,CAAC,gBAAgB;QAC1C,gBAAgB,EAAE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC5D,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QACH,SAAS,EAAE,QAAQ,CAAC,SAAS;KAC9B,CAAC;AACJ,CAAC;AA3BD,8DA2BC","sourcesContent":["import { Infer } from '@metamask/superstruct';\n\nimport { VaultApyResponse } from './response.types';\nimport { VaultApyResponseStruct } from './structs';\n\n/**\n * Normalizes the raw response from the Veda performance API into the expected\n * format.\n *\n * @param rawResponse - The raw response from the Veda performance API.\n * @returns The normalized response.\n */\nexport function normalizeVaultApyResponse(\n rawResponse: Infer<typeof VaultApyResponseStruct>,\n): VaultApyResponse {\n const { Response: response } = rawResponse;\n\n return {\n aggregationPeriod: response.aggregation_period,\n apy: response.apy,\n chainAllocation: response.chain_allocation,\n fees: response.fees,\n globalApyBreakdown: response.global_apy_breakdown\n ? {\n fee: response.global_apy_breakdown.fee,\n maturityApy: response.global_apy_breakdown.maturity_apy,\n realApy: response.global_apy_breakdown.real_apy,\n }\n : undefined,\n performanceFees: response.performance_fees,\n realApyBreakdown: response.real_apy_breakdown?.map((item) => ({\n allocation: item.allocation,\n apy: item.apy,\n apyNet: item.apy_net,\n chain: item.chain,\n protocol: item.protocol,\n })),\n timestamp: response.timestamp,\n };\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { Infer } from "@metamask/superstruct";
2
- import { VaultApyResponseStruct } from "./structs.cjs";
3
2
  import { VaultApyResponse } from "./response.types.cjs";
3
+ import { VaultApyResponseStruct } from "./structs.cjs";
4
4
  /**
5
5
  * Normalizes the raw response from the Veda performance API into the expected
6
6
  * format.
@@ -1 +1 @@
1
- {"version":3,"file":"requestNormalization.d.cts","sourceRoot":"","sources":["../../src/money-account-balance-service/requestNormalization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,8BAA8B;AAE9C,OAAO,EAAE,sBAAsB,EAAE,sBAAkB;AACnD,OAAO,EAAE,gBAAgB,EAAE,6BAAyB;AAEpD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,KAAK,CAAC,OAAO,sBAAsB,CAAC,GAChD,gBAAgB,CAuBlB"}
1
+ {"version":3,"file":"requestNormalization.d.cts","sourceRoot":"","sources":["../../src/money-account-balance-service/requestNormalization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,8BAA8B;AAE9C,OAAO,EAAE,gBAAgB,EAAE,6BAAyB;AACpD,OAAO,EAAE,sBAAsB,EAAE,sBAAkB;AAEnD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,KAAK,CAAC,OAAO,sBAAsB,CAAC,GAChD,gBAAgB,CAyBlB"}
@@ -1,6 +1,6 @@
1
1
  import { Infer } from "@metamask/superstruct";
2
- import { VaultApyResponseStruct } from "./structs.mjs";
3
2
  import { VaultApyResponse } from "./response.types.mjs";
3
+ import { VaultApyResponseStruct } from "./structs.mjs";
4
4
  /**
5
5
  * Normalizes the raw response from the Veda performance API into the expected
6
6
  * format.
@@ -1 +1 @@
1
- {"version":3,"file":"requestNormalization.d.mts","sourceRoot":"","sources":["../../src/money-account-balance-service/requestNormalization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,8BAA8B;AAE9C,OAAO,EAAE,sBAAsB,EAAE,sBAAkB;AACnD,OAAO,EAAE,gBAAgB,EAAE,6BAAyB;AAEpD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,KAAK,CAAC,OAAO,sBAAsB,CAAC,GAChD,gBAAgB,CAuBlB"}
1
+ {"version":3,"file":"requestNormalization.d.mts","sourceRoot":"","sources":["../../src/money-account-balance-service/requestNormalization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,8BAA8B;AAE9C,OAAO,EAAE,gBAAgB,EAAE,6BAAyB;AACpD,OAAO,EAAE,sBAAsB,EAAE,sBAAkB;AAEnD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,KAAK,CAAC,OAAO,sBAAsB,CAAC,GAChD,gBAAgB,CAyBlB"}
@@ -13,13 +13,15 @@ export function normalizeVaultApyResponse(rawResponse) {
13
13
  apy: response.apy,
14
14
  chainAllocation: response.chain_allocation,
15
15
  fees: response.fees,
16
- globalApyBreakdown: {
17
- fee: response.global_apy_breakdown.fee,
18
- maturityApy: response.global_apy_breakdown.maturity_apy,
19
- realApy: response.global_apy_breakdown.real_apy,
20
- },
16
+ globalApyBreakdown: response.global_apy_breakdown
17
+ ? {
18
+ fee: response.global_apy_breakdown.fee,
19
+ maturityApy: response.global_apy_breakdown.maturity_apy,
20
+ realApy: response.global_apy_breakdown.real_apy,
21
+ }
22
+ : undefined,
21
23
  performanceFees: response.performance_fees,
22
- realApyBreakdown: response.real_apy_breakdown.map((item) => ({
24
+ realApyBreakdown: response.real_apy_breakdown?.map((item) => ({
23
25
  allocation: item.allocation,
24
26
  apy: item.apy,
25
27
  apyNet: item.apy_net,
@@ -1 +1 @@
1
- {"version":3,"file":"requestNormalization.mjs","sourceRoot":"","sources":["../../src/money-account-balance-service/requestNormalization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,sBAAkB;AAGnD;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACvC,WAAiD;IAEjD,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC;IAE3C,OAAO;QACL,iBAAiB,EAAE,QAAQ,CAAC,kBAAkB;QAC9C,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,eAAe,EAAE,QAAQ,CAAC,gBAAgB;QAC1C,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,kBAAkB,EAAE;YAClB,GAAG,EAAE,QAAQ,CAAC,oBAAoB,CAAC,GAAG;YACtC,WAAW,EAAE,QAAQ,CAAC,oBAAoB,CAAC,YAAY;YACvD,OAAO,EAAE,QAAQ,CAAC,oBAAoB,CAAC,QAAQ;SAChD;QACD,eAAe,EAAE,QAAQ,CAAC,gBAAgB;QAC1C,gBAAgB,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC3D,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QACH,SAAS,EAAE,QAAQ,CAAC,SAAS;KAC9B,CAAC;AACJ,CAAC","sourcesContent":["import { Infer } from '@metamask/superstruct';\n\nimport { VaultApyResponseStruct } from './structs';\nimport { VaultApyResponse } from './response.types';\n\n/**\n * Normalizes the raw response from the Veda performance API into the expected\n * format.\n *\n * @param rawResponse - The raw response from the Veda performance API.\n * @returns The normalized response.\n */\nexport function normalizeVaultApyResponse(\n rawResponse: Infer<typeof VaultApyResponseStruct>,\n): VaultApyResponse {\n const { Response: response } = rawResponse;\n\n return {\n aggregationPeriod: response.aggregation_period,\n apy: response.apy,\n chainAllocation: response.chain_allocation,\n fees: response.fees,\n globalApyBreakdown: {\n fee: response.global_apy_breakdown.fee,\n maturityApy: response.global_apy_breakdown.maturity_apy,\n realApy: response.global_apy_breakdown.real_apy,\n },\n performanceFees: response.performance_fees,\n realApyBreakdown: response.real_apy_breakdown.map((item) => ({\n allocation: item.allocation,\n apy: item.apy,\n apyNet: item.apy_net,\n chain: item.chain,\n protocol: item.protocol,\n })),\n timestamp: response.timestamp,\n };\n}\n"]}
1
+ {"version":3,"file":"requestNormalization.mjs","sourceRoot":"","sources":["../../src/money-account-balance-service/requestNormalization.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,sBAAkB;AAEnD;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACvC,WAAiD;IAEjD,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC;IAE3C,OAAO;QACL,iBAAiB,EAAE,QAAQ,CAAC,kBAAkB;QAC9C,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,eAAe,EAAE,QAAQ,CAAC,gBAAgB;QAC1C,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,kBAAkB,EAAE,QAAQ,CAAC,oBAAoB;YAC/C,CAAC,CAAC;gBACE,GAAG,EAAE,QAAQ,CAAC,oBAAoB,CAAC,GAAG;gBACtC,WAAW,EAAE,QAAQ,CAAC,oBAAoB,CAAC,YAAY;gBACvD,OAAO,EAAE,QAAQ,CAAC,oBAAoB,CAAC,QAAQ;aAChD;YACH,CAAC,CAAC,SAAS;QACb,eAAe,EAAE,QAAQ,CAAC,gBAAgB;QAC1C,gBAAgB,EAAE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC5D,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QACH,SAAS,EAAE,QAAQ,CAAC,SAAS;KAC9B,CAAC;AACJ,CAAC","sourcesContent":["import { Infer } from '@metamask/superstruct';\n\nimport { VaultApyResponse } from './response.types';\nimport { VaultApyResponseStruct } from './structs';\n\n/**\n * Normalizes the raw response from the Veda performance API into the expected\n * format.\n *\n * @param rawResponse - The raw response from the Veda performance API.\n * @returns The normalized response.\n */\nexport function normalizeVaultApyResponse(\n rawResponse: Infer<typeof VaultApyResponseStruct>,\n): VaultApyResponse {\n const { Response: response } = rawResponse;\n\n return {\n aggregationPeriod: response.aggregation_period,\n apy: response.apy,\n chainAllocation: response.chain_allocation,\n fees: response.fees,\n globalApyBreakdown: response.global_apy_breakdown\n ? {\n fee: response.global_apy_breakdown.fee,\n maturityApy: response.global_apy_breakdown.maturity_apy,\n realApy: response.global_apy_breakdown.real_apy,\n }\n : undefined,\n performanceFees: response.performance_fees,\n realApyBreakdown: response.real_apy_breakdown?.map((item) => ({\n allocation: item.allocation,\n apy: item.apy,\n apyNet: item.apy_net,\n chain: item.chain,\n protocol: item.protocol,\n })),\n timestamp: response.timestamp,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"response.types.cjs","sourceRoot":"","sources":["../../src/money-account-balance-service/response.types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Response from {@link MoneyAccountBalanceService.#fetchErc20Balance}.\n * Balance is a raw uint256 string (no decimal normalization).\n */\nexport type Erc20BalanceResponse = {\n balance: string;\n};\n\n/**\n * Response from {@link MoneyAccountBalanceService.getExchangeRate}.\n * Rate is the raw uint256 string returned by the Accountant's `getRate()`.\n */\nexport type ExchangeRateResponse = {\n rate: string;\n};\n\n/**\n * Response from {@link MoneyAccountBalanceService.getMusdEquivalentValue}.\n * All values are raw uint256 strings. The `musdEquivalentValue` is\n * `musdSHFvdBalance * exchangeRate / 10^underlyingTokenDecimals` (= 1e6 for mUSD).\n */\nexport type MusdEquivalentValueResponse = {\n musdSHFvdBalance: string;\n exchangeRate: string;\n musdEquivalentValue: string;\n};\n\n/**\n * Response from {@link MoneyAccountBalanceService.getVaultApy}.\n * All APY / fee values are decimals (multiply by 100 for percentage).\n */\nexport type VaultApyResponse = {\n aggregationPeriod: string; // E.g. \"7 days\"\n apy: number;\n chainAllocation: {\n [network: string]: number;\n };\n fees: number;\n globalApyBreakdown: {\n fee: number;\n maturityApy: number;\n realApy: number;\n };\n performanceFees: number;\n realApyBreakdown: {\n allocation: number;\n apy: number;\n apyNet: number;\n chain: string;\n protocol: string;\n }[];\n timestamp: string;\n};\n"]}
1
+ {"version":3,"file":"response.types.cjs","sourceRoot":"","sources":["../../src/money-account-balance-service/response.types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Response from {@link MoneyAccountBalanceService.#fetchErc20Balance}.\n * Balance is a raw uint256 string (no decimal normalization).\n */\nexport type Erc20BalanceResponse = {\n balance: string;\n};\n\n/**\n * Response from {@link MoneyAccountBalanceService.getExchangeRate}.\n * Rate is the raw uint256 string returned by the Accountant's `getRate()`.\n */\nexport type ExchangeRateResponse = {\n rate: string;\n};\n\n/**\n * Response from {@link MoneyAccountBalanceService.getMusdEquivalentValue}.\n * All values are raw uint256 strings. The `musdEquivalentValue` is\n * `musdSHFvdBalance * exchangeRate / 10^underlyingTokenDecimals` (= 1e6 for mUSD).\n */\nexport type MusdEquivalentValueResponse = {\n musdSHFvdBalance: string;\n exchangeRate: string;\n musdEquivalentValue: string;\n};\n\n/**\n * Response from {@link MoneyAccountBalanceService.getVaultApy}.\n * All APY / fee values are decimals (multiply by 100 for percentage).\n *\n * Only `apy` and `timestamp` are guaranteed to be present — all other fields\n * are optional because the Veda API omits them when the vault has no activity.\n */\nexport type VaultApyResponse = {\n aggregationPeriod?: string; // E.g. \"7 days\"\n apy: number;\n chainAllocation?: {\n [network: string]: number;\n };\n fees?: number;\n globalApyBreakdown?: {\n fee?: number;\n maturityApy?: number;\n realApy?: number;\n };\n performanceFees?: number;\n realApyBreakdown?: {\n allocation?: number;\n apy?: number;\n apyNet?: number;\n chain?: string;\n protocol?: string;\n }[];\n timestamp: string;\n};\n"]}
@@ -25,26 +25,29 @@ export type MusdEquivalentValueResponse = {
25
25
  /**
26
26
  * Response from {@link MoneyAccountBalanceService.getVaultApy}.
27
27
  * All APY / fee values are decimals (multiply by 100 for percentage).
28
+ *
29
+ * Only `apy` and `timestamp` are guaranteed to be present — all other fields
30
+ * are optional because the Veda API omits them when the vault has no activity.
28
31
  */
29
32
  export type VaultApyResponse = {
30
- aggregationPeriod: string;
33
+ aggregationPeriod?: string;
31
34
  apy: number;
32
- chainAllocation: {
35
+ chainAllocation?: {
33
36
  [network: string]: number;
34
37
  };
35
- fees: number;
36
- globalApyBreakdown: {
37
- fee: number;
38
- maturityApy: number;
39
- realApy: number;
38
+ fees?: number;
39
+ globalApyBreakdown?: {
40
+ fee?: number;
41
+ maturityApy?: number;
42
+ realApy?: number;
40
43
  };
41
- performanceFees: number;
42
- realApyBreakdown: {
43
- allocation: number;
44
- apy: number;
45
- apyNet: number;
46
- chain: string;
47
- protocol: string;
44
+ performanceFees?: number;
45
+ realApyBreakdown?: {
46
+ allocation?: number;
47
+ apy?: number;
48
+ apyNet?: number;
49
+ chain?: string;
50
+ protocol?: string;
48
51
  }[];
49
52
  timestamp: string;
50
53
  };
@@ -1 +1 @@
1
- {"version":3,"file":"response.types.d.cts","sourceRoot":"","sources":["../../src/money-account-balance-service/response.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE;QACf,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;KAC3B,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE;QAClB,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,EAAE,CAAC;IACJ,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
1
+ {"version":3,"file":"response.types.d.cts","sourceRoot":"","sources":["../../src/money-account-balance-service/response.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,CAAC,EAAE;QAChB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;KAC3B,CAAC;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE;QACnB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,EAAE,CAAC;IACJ,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
@@ -25,26 +25,29 @@ export type MusdEquivalentValueResponse = {
25
25
  /**
26
26
  * Response from {@link MoneyAccountBalanceService.getVaultApy}.
27
27
  * All APY / fee values are decimals (multiply by 100 for percentage).
28
+ *
29
+ * Only `apy` and `timestamp` are guaranteed to be present — all other fields
30
+ * are optional because the Veda API omits them when the vault has no activity.
28
31
  */
29
32
  export type VaultApyResponse = {
30
- aggregationPeriod: string;
33
+ aggregationPeriod?: string;
31
34
  apy: number;
32
- chainAllocation: {
35
+ chainAllocation?: {
33
36
  [network: string]: number;
34
37
  };
35
- fees: number;
36
- globalApyBreakdown: {
37
- fee: number;
38
- maturityApy: number;
39
- realApy: number;
38
+ fees?: number;
39
+ globalApyBreakdown?: {
40
+ fee?: number;
41
+ maturityApy?: number;
42
+ realApy?: number;
40
43
  };
41
- performanceFees: number;
42
- realApyBreakdown: {
43
- allocation: number;
44
- apy: number;
45
- apyNet: number;
46
- chain: string;
47
- protocol: string;
44
+ performanceFees?: number;
45
+ realApyBreakdown?: {
46
+ allocation?: number;
47
+ apy?: number;
48
+ apyNet?: number;
49
+ chain?: string;
50
+ protocol?: string;
48
51
  }[];
49
52
  timestamp: string;
50
53
  };
@@ -1 +1 @@
1
- {"version":3,"file":"response.types.d.mts","sourceRoot":"","sources":["../../src/money-account-balance-service/response.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE;QACf,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;KAC3B,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE;QAClB,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,EAAE,CAAC;IACJ,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
1
+ {"version":3,"file":"response.types.d.mts","sourceRoot":"","sources":["../../src/money-account-balance-service/response.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,CAAC,EAAE;QAChB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;KAC3B,CAAC;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE;QACnB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,EAAE,CAAC;IACJ,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"response.types.mjs","sourceRoot":"","sources":["../../src/money-account-balance-service/response.types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Response from {@link MoneyAccountBalanceService.#fetchErc20Balance}.\n * Balance is a raw uint256 string (no decimal normalization).\n */\nexport type Erc20BalanceResponse = {\n balance: string;\n};\n\n/**\n * Response from {@link MoneyAccountBalanceService.getExchangeRate}.\n * Rate is the raw uint256 string returned by the Accountant's `getRate()`.\n */\nexport type ExchangeRateResponse = {\n rate: string;\n};\n\n/**\n * Response from {@link MoneyAccountBalanceService.getMusdEquivalentValue}.\n * All values are raw uint256 strings. The `musdEquivalentValue` is\n * `musdSHFvdBalance * exchangeRate / 10^underlyingTokenDecimals` (= 1e6 for mUSD).\n */\nexport type MusdEquivalentValueResponse = {\n musdSHFvdBalance: string;\n exchangeRate: string;\n musdEquivalentValue: string;\n};\n\n/**\n * Response from {@link MoneyAccountBalanceService.getVaultApy}.\n * All APY / fee values are decimals (multiply by 100 for percentage).\n */\nexport type VaultApyResponse = {\n aggregationPeriod: string; // E.g. \"7 days\"\n apy: number;\n chainAllocation: {\n [network: string]: number;\n };\n fees: number;\n globalApyBreakdown: {\n fee: number;\n maturityApy: number;\n realApy: number;\n };\n performanceFees: number;\n realApyBreakdown: {\n allocation: number;\n apy: number;\n apyNet: number;\n chain: string;\n protocol: string;\n }[];\n timestamp: string;\n};\n"]}
1
+ {"version":3,"file":"response.types.mjs","sourceRoot":"","sources":["../../src/money-account-balance-service/response.types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Response from {@link MoneyAccountBalanceService.#fetchErc20Balance}.\n * Balance is a raw uint256 string (no decimal normalization).\n */\nexport type Erc20BalanceResponse = {\n balance: string;\n};\n\n/**\n * Response from {@link MoneyAccountBalanceService.getExchangeRate}.\n * Rate is the raw uint256 string returned by the Accountant's `getRate()`.\n */\nexport type ExchangeRateResponse = {\n rate: string;\n};\n\n/**\n * Response from {@link MoneyAccountBalanceService.getMusdEquivalentValue}.\n * All values are raw uint256 strings. The `musdEquivalentValue` is\n * `musdSHFvdBalance * exchangeRate / 10^underlyingTokenDecimals` (= 1e6 for mUSD).\n */\nexport type MusdEquivalentValueResponse = {\n musdSHFvdBalance: string;\n exchangeRate: string;\n musdEquivalentValue: string;\n};\n\n/**\n * Response from {@link MoneyAccountBalanceService.getVaultApy}.\n * All APY / fee values are decimals (multiply by 100 for percentage).\n *\n * Only `apy` and `timestamp` are guaranteed to be present — all other fields\n * are optional because the Veda API omits them when the vault has no activity.\n */\nexport type VaultApyResponse = {\n aggregationPeriod?: string; // E.g. \"7 days\"\n apy: number;\n chainAllocation?: {\n [network: string]: number;\n };\n fees?: number;\n globalApyBreakdown?: {\n fee?: number;\n maturityApy?: number;\n realApy?: number;\n };\n performanceFees?: number;\n realApyBreakdown?: {\n allocation?: number;\n apy?: number;\n apyNet?: number;\n chain?: string;\n protocol?: string;\n }[];\n timestamp: string;\n};\n"]}
@@ -7,26 +7,29 @@ const superstruct_1 = require("@metamask/superstruct");
7
7
  *
8
8
  * Uses `type()` (loose validation) so that unknown fields returned by the
9
9
  * Veda API do not cause validation failures.
10
+ *
11
+ * Only `apy` and `timestamp` are required — all other fields are optional
12
+ * because the Veda API omits some fields when the vault has no activity.
10
13
  */
11
14
  exports.VaultApyResponseStruct = (0, superstruct_1.type)({
12
15
  Response: (0, superstruct_1.type)({
13
- aggregation_period: (0, superstruct_1.string)(),
16
+ aggregation_period: (0, superstruct_1.optional)((0, superstruct_1.string)()),
14
17
  apy: (0, superstruct_1.number)(),
15
- chain_allocation: (0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.number)()),
16
- fees: (0, superstruct_1.number)(),
17
- global_apy_breakdown: (0, superstruct_1.type)({
18
- fee: (0, superstruct_1.number)(),
19
- maturity_apy: (0, superstruct_1.number)(),
20
- real_apy: (0, superstruct_1.number)(),
21
- }),
22
- performance_fees: (0, superstruct_1.number)(),
23
- real_apy_breakdown: (0, superstruct_1.array)((0, superstruct_1.type)({
24
- allocation: (0, superstruct_1.number)(),
25
- apy: (0, superstruct_1.number)(),
26
- apy_net: (0, superstruct_1.number)(),
27
- chain: (0, superstruct_1.string)(),
28
- protocol: (0, superstruct_1.string)(),
18
+ chain_allocation: (0, superstruct_1.optional)((0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.number)())),
19
+ fees: (0, superstruct_1.optional)((0, superstruct_1.number)()),
20
+ global_apy_breakdown: (0, superstruct_1.optional)((0, superstruct_1.type)({
21
+ fee: (0, superstruct_1.optional)((0, superstruct_1.number)()),
22
+ maturity_apy: (0, superstruct_1.optional)((0, superstruct_1.number)()),
23
+ real_apy: (0, superstruct_1.optional)((0, superstruct_1.number)()),
29
24
  })),
25
+ performance_fees: (0, superstruct_1.optional)((0, superstruct_1.number)()),
26
+ real_apy_breakdown: (0, superstruct_1.optional)((0, superstruct_1.array)((0, superstruct_1.type)({
27
+ allocation: (0, superstruct_1.optional)((0, superstruct_1.number)()),
28
+ apy: (0, superstruct_1.optional)((0, superstruct_1.number)()),
29
+ apy_net: (0, superstruct_1.optional)((0, superstruct_1.number)()),
30
+ chain: (0, superstruct_1.optional)((0, superstruct_1.string)()),
31
+ protocol: (0, superstruct_1.optional)((0, superstruct_1.string)()),
32
+ }))),
30
33
  timestamp: (0, superstruct_1.string)(),
31
34
  }),
32
35
  });
@@ -1 +1 @@
1
- {"version":3,"file":"structs.cjs","sourceRoot":"","sources":["../../src/money-account-balance-service/structs.ts"],"names":[],"mappings":";;;AAAA,uDAA4E;AAE5E;;;;;GAKG;AACU,QAAA,sBAAsB,GAAG,IAAA,kBAAI,EAAC;IACzC,QAAQ,EAAE,IAAA,kBAAI,EAAC;QACb,kBAAkB,EAAE,IAAA,oBAAM,GAAE;QAC5B,GAAG,EAAE,IAAA,oBAAM,GAAE;QACb,gBAAgB,EAAE,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,CAAC;QAC5C,IAAI,EAAE,IAAA,oBAAM,GAAE;QACd,oBAAoB,EAAE,IAAA,kBAAI,EAAC;YACzB,GAAG,EAAE,IAAA,oBAAM,GAAE;YACb,YAAY,EAAE,IAAA,oBAAM,GAAE;YACtB,QAAQ,EAAE,IAAA,oBAAM,GAAE;SACnB,CAAC;QACF,gBAAgB,EAAE,IAAA,oBAAM,GAAE;QAC1B,kBAAkB,EAAE,IAAA,mBAAK,EACvB,IAAA,kBAAI,EAAC;YACH,UAAU,EAAE,IAAA,oBAAM,GAAE;YACpB,GAAG,EAAE,IAAA,oBAAM,GAAE;YACb,OAAO,EAAE,IAAA,oBAAM,GAAE;YACjB,KAAK,EAAE,IAAA,oBAAM,GAAE;YACf,QAAQ,EAAE,IAAA,oBAAM,GAAE;SACnB,CAAC,CACH;QACD,SAAS,EAAE,IAAA,oBAAM,GAAE;KACpB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { array, number, record, string, type } from '@metamask/superstruct';\n\n/**\n * Superstruct schema for {@link VaultApyResponse}.\n *\n * Uses `type()` (loose validation) so that unknown fields returned by the\n * Veda API do not cause validation failures.\n */\nexport const VaultApyResponseStruct = type({\n Response: type({\n aggregation_period: string(),\n apy: number(),\n chain_allocation: record(string(), number()),\n fees: number(),\n global_apy_breakdown: type({\n fee: number(),\n maturity_apy: number(),\n real_apy: number(),\n }),\n performance_fees: number(),\n real_apy_breakdown: array(\n type({\n allocation: number(),\n apy: number(),\n apy_net: number(),\n chain: string(),\n protocol: string(),\n }),\n ),\n timestamp: string(),\n }),\n});\n"]}
1
+ {"version":3,"file":"structs.cjs","sourceRoot":"","sources":["../../src/money-account-balance-service/structs.ts"],"names":[],"mappings":";;;AAAA,uDAO+B;AAE/B;;;;;;;;GAQG;AACU,QAAA,sBAAsB,GAAG,IAAA,kBAAI,EAAC;IACzC,QAAQ,EAAE,IAAA,kBAAI,EAAC;QACb,kBAAkB,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;QACtC,GAAG,EAAE,IAAA,oBAAM,GAAE;QACb,gBAAgB,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,EAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,CAAC,CAAC;QACtD,IAAI,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;QACxB,oBAAoB,EAAE,IAAA,sBAAQ,EAC5B,IAAA,kBAAI,EAAC;YACH,GAAG,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;YACvB,YAAY,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;YAChC,QAAQ,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;SAC7B,CAAC,CACH;QACD,gBAAgB,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;QACpC,kBAAkB,EAAE,IAAA,sBAAQ,EAC1B,IAAA,mBAAK,EACH,IAAA,kBAAI,EAAC;YACH,UAAU,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;YAC9B,GAAG,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;YACvB,OAAO,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;YAC3B,KAAK,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;YACzB,QAAQ,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;SAC7B,CAAC,CACH,CACF;QACD,SAAS,EAAE,IAAA,oBAAM,GAAE;KACpB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import {\n array,\n number,\n optional,\n record,\n string,\n type,\n} from '@metamask/superstruct';\n\n/**\n * Superstruct schema for {@link VaultApyResponse}.\n *\n * Uses `type()` (loose validation) so that unknown fields returned by the\n * Veda API do not cause validation failures.\n *\n * Only `apy` and `timestamp` are required — all other fields are optional\n * because the Veda API omits some fields when the vault has no activity.\n */\nexport const VaultApyResponseStruct = type({\n Response: type({\n aggregation_period: optional(string()),\n apy: number(),\n chain_allocation: optional(record(string(), number())),\n fees: optional(number()),\n global_apy_breakdown: optional(\n type({\n fee: optional(number()),\n maturity_apy: optional(number()),\n real_apy: optional(number()),\n }),\n ),\n performance_fees: optional(number()),\n real_apy_breakdown: optional(\n array(\n type({\n allocation: optional(number()),\n apy: optional(number()),\n apy_net: optional(number()),\n chain: optional(string()),\n protocol: optional(string()),\n }),\n ),\n ),\n timestamp: string(),\n }),\n});\n"]}
@@ -3,81 +3,84 @@
3
3
  *
4
4
  * Uses `type()` (loose validation) so that unknown fields returned by the
5
5
  * Veda API do not cause validation failures.
6
+ *
7
+ * Only `apy` and `timestamp` are required — all other fields are optional
8
+ * because the Veda API omits some fields when the vault has no activity.
6
9
  */
7
10
  export declare const VaultApyResponseStruct: import("@metamask/superstruct").Struct<{
8
11
  Response: {
9
12
  apy: number;
10
- aggregation_period: string;
11
- chain_allocation: Record<string, number>;
12
- fees: number;
13
- global_apy_breakdown: {
14
- fee: number;
15
- maturity_apy: number;
16
- real_apy: number;
17
- };
18
- performance_fees: number;
19
- real_apy_breakdown: {
20
- allocation: number;
21
- apy: number;
22
- apy_net: number;
23
- chain: string;
24
- protocol: string;
25
- }[];
26
13
  timestamp: string;
14
+ aggregation_period?: string | undefined;
15
+ chain_allocation?: Record<string, number> | undefined;
16
+ fees?: number | undefined;
17
+ global_apy_breakdown?: {
18
+ fee?: number | undefined;
19
+ maturity_apy?: number | undefined;
20
+ real_apy?: number | undefined;
21
+ } | undefined;
22
+ performance_fees?: number | undefined;
23
+ real_apy_breakdown?: {
24
+ allocation?: number | undefined;
25
+ apy?: number | undefined;
26
+ apy_net?: number | undefined;
27
+ chain?: string | undefined;
28
+ protocol?: string | undefined;
29
+ }[] | undefined;
27
30
  };
28
31
  }, {
29
32
  Response: import("@metamask/superstruct").Struct<{
30
33
  apy: number;
31
- aggregation_period: string;
32
- chain_allocation: Record<string, number>;
33
- fees: number;
34
- global_apy_breakdown: {
35
- fee: number;
36
- maturity_apy: number;
37
- real_apy: number;
38
- };
39
- performance_fees: number;
40
- real_apy_breakdown: {
41
- allocation: number;
42
- apy: number;
43
- apy_net: number;
44
- chain: string;
45
- protocol: string;
46
- }[];
47
34
  timestamp: string;
35
+ aggregation_period?: string | undefined;
36
+ chain_allocation?: Record<string, number> | undefined;
37
+ fees?: number | undefined;
38
+ global_apy_breakdown?: {
39
+ fee?: number | undefined;
40
+ maturity_apy?: number | undefined;
41
+ real_apy?: number | undefined;
42
+ } | undefined;
43
+ performance_fees?: number | undefined;
44
+ real_apy_breakdown?: {
45
+ allocation?: number | undefined;
46
+ apy?: number | undefined;
47
+ apy_net?: number | undefined;
48
+ chain?: string | undefined;
49
+ protocol?: string | undefined;
50
+ }[] | undefined;
48
51
  }, {
49
- aggregation_period: import("@metamask/superstruct").Struct<string, null>;
52
+ aggregation_period: import("@metamask/superstruct").Struct<string | undefined, null>;
50
53
  apy: import("@metamask/superstruct").Struct<number, null>;
51
- chain_allocation: import("@metamask/superstruct").Struct<Record<string, number>, null>;
52
- fees: import("@metamask/superstruct").Struct<number, null>;
54
+ chain_allocation: import("@metamask/superstruct").Struct<Record<string, number> | undefined, null>;
55
+ fees: import("@metamask/superstruct").Struct<number | undefined, null>;
53
56
  global_apy_breakdown: import("@metamask/superstruct").Struct<{
54
- fee: number;
55
- maturity_apy: number;
56
- real_apy: number;
57
- }, {
58
- fee: import("@metamask/superstruct").Struct<number, null>;
59
- maturity_apy: import("@metamask/superstruct").Struct<number, null>;
60
- real_apy: import("@metamask/superstruct").Struct<number, null>;
57
+ fee?: number | undefined;
58
+ maturity_apy?: number | undefined;
59
+ real_apy?: number | undefined;
60
+ } | undefined, {
61
+ fee: import("@metamask/superstruct").Struct<number | undefined, null>;
62
+ maturity_apy: import("@metamask/superstruct").Struct<number | undefined, null>;
63
+ real_apy: import("@metamask/superstruct").Struct<number | undefined, null>;
61
64
  }>;
62
- performance_fees: import("@metamask/superstruct").Struct<number, null>;
65
+ performance_fees: import("@metamask/superstruct").Struct<number | undefined, null>;
63
66
  real_apy_breakdown: import("@metamask/superstruct").Struct<{
64
- allocation: number;
65
- apy: number;
66
- apy_net: number;
67
- chain: string;
68
- protocol: string;
69
- }[], import("@metamask/superstruct").Struct<{
70
- allocation: number;
71
- apy: number;
72
- apy_net: number;
73
- chain: string;
74
- protocol: string;
67
+ allocation?: number | undefined;
68
+ apy?: number | undefined;
69
+ apy_net?: number | undefined;
70
+ chain?: string | undefined;
71
+ protocol?: string | undefined;
72
+ }[] | undefined, import("@metamask/superstruct").Struct<{
73
+ allocation?: number | undefined;
74
+ apy?: number | undefined;
75
+ apy_net?: number | undefined;
76
+ chain?: string | undefined;
77
+ protocol?: string | undefined;
75
78
  }, {
76
- allocation: import("@metamask/superstruct").Struct<number, null>;
77
- apy: import("@metamask/superstruct").Struct<number, null>;
78
- apy_net: import("@metamask/superstruct").Struct<number, null>;
79
- chain: import("@metamask/superstruct").Struct<string, null>;
80
- protocol: import("@metamask/superstruct").Struct<string, null>;
79
+ allocation: import("@metamask/superstruct").Struct<number | undefined, null>;
80
+ apy: import("@metamask/superstruct").Struct<number | undefined, null>;
81
+ apy_net: import("@metamask/superstruct").Struct<number | undefined, null>;
82
+ chain: import("@metamask/superstruct").Struct<string | undefined, null>;
83
+ protocol: import("@metamask/superstruct").Struct<string | undefined, null>;
81
84
  }>>;
82
85
  timestamp: import("@metamask/superstruct").Struct<string, null>;
83
86
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"structs.d.cts","sourceRoot":"","sources":["../../src/money-account-balance-service/structs.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBjC,CAAC"}
1
+ {"version":3,"file":"structs.d.cts","sourceRoot":"","sources":["../../src/money-account-balance-service/structs.ts"],"names":[],"mappings":"AASA;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BjC,CAAC"}
@@ -3,81 +3,84 @@
3
3
  *
4
4
  * Uses `type()` (loose validation) so that unknown fields returned by the
5
5
  * Veda API do not cause validation failures.
6
+ *
7
+ * Only `apy` and `timestamp` are required — all other fields are optional
8
+ * because the Veda API omits some fields when the vault has no activity.
6
9
  */
7
10
  export declare const VaultApyResponseStruct: import("@metamask/superstruct").Struct<{
8
11
  Response: {
9
12
  apy: number;
10
- aggregation_period: string;
11
- chain_allocation: Record<string, number>;
12
- fees: number;
13
- global_apy_breakdown: {
14
- fee: number;
15
- maturity_apy: number;
16
- real_apy: number;
17
- };
18
- performance_fees: number;
19
- real_apy_breakdown: {
20
- allocation: number;
21
- apy: number;
22
- apy_net: number;
23
- chain: string;
24
- protocol: string;
25
- }[];
26
13
  timestamp: string;
14
+ aggregation_period?: string | undefined;
15
+ chain_allocation?: Record<string, number> | undefined;
16
+ fees?: number | undefined;
17
+ global_apy_breakdown?: {
18
+ fee?: number | undefined;
19
+ maturity_apy?: number | undefined;
20
+ real_apy?: number | undefined;
21
+ } | undefined;
22
+ performance_fees?: number | undefined;
23
+ real_apy_breakdown?: {
24
+ allocation?: number | undefined;
25
+ apy?: number | undefined;
26
+ apy_net?: number | undefined;
27
+ chain?: string | undefined;
28
+ protocol?: string | undefined;
29
+ }[] | undefined;
27
30
  };
28
31
  }, {
29
32
  Response: import("@metamask/superstruct").Struct<{
30
33
  apy: number;
31
- aggregation_period: string;
32
- chain_allocation: Record<string, number>;
33
- fees: number;
34
- global_apy_breakdown: {
35
- fee: number;
36
- maturity_apy: number;
37
- real_apy: number;
38
- };
39
- performance_fees: number;
40
- real_apy_breakdown: {
41
- allocation: number;
42
- apy: number;
43
- apy_net: number;
44
- chain: string;
45
- protocol: string;
46
- }[];
47
34
  timestamp: string;
35
+ aggregation_period?: string | undefined;
36
+ chain_allocation?: Record<string, number> | undefined;
37
+ fees?: number | undefined;
38
+ global_apy_breakdown?: {
39
+ fee?: number | undefined;
40
+ maturity_apy?: number | undefined;
41
+ real_apy?: number | undefined;
42
+ } | undefined;
43
+ performance_fees?: number | undefined;
44
+ real_apy_breakdown?: {
45
+ allocation?: number | undefined;
46
+ apy?: number | undefined;
47
+ apy_net?: number | undefined;
48
+ chain?: string | undefined;
49
+ protocol?: string | undefined;
50
+ }[] | undefined;
48
51
  }, {
49
- aggregation_period: import("@metamask/superstruct").Struct<string, null>;
52
+ aggregation_period: import("@metamask/superstruct").Struct<string | undefined, null>;
50
53
  apy: import("@metamask/superstruct").Struct<number, null>;
51
- chain_allocation: import("@metamask/superstruct").Struct<Record<string, number>, null>;
52
- fees: import("@metamask/superstruct").Struct<number, null>;
54
+ chain_allocation: import("@metamask/superstruct").Struct<Record<string, number> | undefined, null>;
55
+ fees: import("@metamask/superstruct").Struct<number | undefined, null>;
53
56
  global_apy_breakdown: import("@metamask/superstruct").Struct<{
54
- fee: number;
55
- maturity_apy: number;
56
- real_apy: number;
57
- }, {
58
- fee: import("@metamask/superstruct").Struct<number, null>;
59
- maturity_apy: import("@metamask/superstruct").Struct<number, null>;
60
- real_apy: import("@metamask/superstruct").Struct<number, null>;
57
+ fee?: number | undefined;
58
+ maturity_apy?: number | undefined;
59
+ real_apy?: number | undefined;
60
+ } | undefined, {
61
+ fee: import("@metamask/superstruct").Struct<number | undefined, null>;
62
+ maturity_apy: import("@metamask/superstruct").Struct<number | undefined, null>;
63
+ real_apy: import("@metamask/superstruct").Struct<number | undefined, null>;
61
64
  }>;
62
- performance_fees: import("@metamask/superstruct").Struct<number, null>;
65
+ performance_fees: import("@metamask/superstruct").Struct<number | undefined, null>;
63
66
  real_apy_breakdown: import("@metamask/superstruct").Struct<{
64
- allocation: number;
65
- apy: number;
66
- apy_net: number;
67
- chain: string;
68
- protocol: string;
69
- }[], import("@metamask/superstruct").Struct<{
70
- allocation: number;
71
- apy: number;
72
- apy_net: number;
73
- chain: string;
74
- protocol: string;
67
+ allocation?: number | undefined;
68
+ apy?: number | undefined;
69
+ apy_net?: number | undefined;
70
+ chain?: string | undefined;
71
+ protocol?: string | undefined;
72
+ }[] | undefined, import("@metamask/superstruct").Struct<{
73
+ allocation?: number | undefined;
74
+ apy?: number | undefined;
75
+ apy_net?: number | undefined;
76
+ chain?: string | undefined;
77
+ protocol?: string | undefined;
75
78
  }, {
76
- allocation: import("@metamask/superstruct").Struct<number, null>;
77
- apy: import("@metamask/superstruct").Struct<number, null>;
78
- apy_net: import("@metamask/superstruct").Struct<number, null>;
79
- chain: import("@metamask/superstruct").Struct<string, null>;
80
- protocol: import("@metamask/superstruct").Struct<string, null>;
79
+ allocation: import("@metamask/superstruct").Struct<number | undefined, null>;
80
+ apy: import("@metamask/superstruct").Struct<number | undefined, null>;
81
+ apy_net: import("@metamask/superstruct").Struct<number | undefined, null>;
82
+ chain: import("@metamask/superstruct").Struct<string | undefined, null>;
83
+ protocol: import("@metamask/superstruct").Struct<string | undefined, null>;
81
84
  }>>;
82
85
  timestamp: import("@metamask/superstruct").Struct<string, null>;
83
86
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"structs.d.mts","sourceRoot":"","sources":["../../src/money-account-balance-service/structs.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBjC,CAAC"}
1
+ {"version":3,"file":"structs.d.mts","sourceRoot":"","sources":["../../src/money-account-balance-service/structs.ts"],"names":[],"mappings":"AASA;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BjC,CAAC"}
@@ -1,29 +1,32 @@
1
- import { array, number, record, string, type } from "@metamask/superstruct";
1
+ import { array, number, optional, record, string, type } from "@metamask/superstruct";
2
2
  /**
3
3
  * Superstruct schema for {@link VaultApyResponse}.
4
4
  *
5
5
  * Uses `type()` (loose validation) so that unknown fields returned by the
6
6
  * Veda API do not cause validation failures.
7
+ *
8
+ * Only `apy` and `timestamp` are required — all other fields are optional
9
+ * because the Veda API omits some fields when the vault has no activity.
7
10
  */
8
11
  export const VaultApyResponseStruct = type({
9
12
  Response: type({
10
- aggregation_period: string(),
13
+ aggregation_period: optional(string()),
11
14
  apy: number(),
12
- chain_allocation: record(string(), number()),
13
- fees: number(),
14
- global_apy_breakdown: type({
15
- fee: number(),
16
- maturity_apy: number(),
17
- real_apy: number(),
18
- }),
19
- performance_fees: number(),
20
- real_apy_breakdown: array(type({
21
- allocation: number(),
22
- apy: number(),
23
- apy_net: number(),
24
- chain: string(),
25
- protocol: string(),
15
+ chain_allocation: optional(record(string(), number())),
16
+ fees: optional(number()),
17
+ global_apy_breakdown: optional(type({
18
+ fee: optional(number()),
19
+ maturity_apy: optional(number()),
20
+ real_apy: optional(number()),
26
21
  })),
22
+ performance_fees: optional(number()),
23
+ real_apy_breakdown: optional(array(type({
24
+ allocation: optional(number()),
25
+ apy: optional(number()),
26
+ apy_net: optional(number()),
27
+ chain: optional(string()),
28
+ protocol: optional(string()),
29
+ }))),
27
30
  timestamp: string(),
28
31
  }),
29
32
  });
@@ -1 +1 @@
1
- {"version":3,"file":"structs.mjs","sourceRoot":"","sources":["../../src/money-account-balance-service/structs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B;AAE5E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;IACzC,QAAQ,EAAE,IAAI,CAAC;QACb,kBAAkB,EAAE,MAAM,EAAE;QAC5B,GAAG,EAAE,MAAM,EAAE;QACb,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC;QAC5C,IAAI,EAAE,MAAM,EAAE;QACd,oBAAoB,EAAE,IAAI,CAAC;YACzB,GAAG,EAAE,MAAM,EAAE;YACb,YAAY,EAAE,MAAM,EAAE;YACtB,QAAQ,EAAE,MAAM,EAAE;SACnB,CAAC;QACF,gBAAgB,EAAE,MAAM,EAAE;QAC1B,kBAAkB,EAAE,KAAK,CACvB,IAAI,CAAC;YACH,UAAU,EAAE,MAAM,EAAE;YACpB,GAAG,EAAE,MAAM,EAAE;YACb,OAAO,EAAE,MAAM,EAAE;YACjB,KAAK,EAAE,MAAM,EAAE;YACf,QAAQ,EAAE,MAAM,EAAE;SACnB,CAAC,CACH;QACD,SAAS,EAAE,MAAM,EAAE;KACpB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { array, number, record, string, type } from '@metamask/superstruct';\n\n/**\n * Superstruct schema for {@link VaultApyResponse}.\n *\n * Uses `type()` (loose validation) so that unknown fields returned by the\n * Veda API do not cause validation failures.\n */\nexport const VaultApyResponseStruct = type({\n Response: type({\n aggregation_period: string(),\n apy: number(),\n chain_allocation: record(string(), number()),\n fees: number(),\n global_apy_breakdown: type({\n fee: number(),\n maturity_apy: number(),\n real_apy: number(),\n }),\n performance_fees: number(),\n real_apy_breakdown: array(\n type({\n allocation: number(),\n apy: number(),\n apy_net: number(),\n chain: string(),\n protocol: string(),\n }),\n ),\n timestamp: string(),\n }),\n});\n"]}
1
+ {"version":3,"file":"structs.mjs","sourceRoot":"","sources":["../../src/money-account-balance-service/structs.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,MAAM,EACN,QAAQ,EACR,MAAM,EACN,MAAM,EACN,IAAI,EACL,8BAA8B;AAE/B;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;IACzC,QAAQ,EAAE,IAAI,CAAC;QACb,kBAAkB,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;QACtC,GAAG,EAAE,MAAM,EAAE;QACb,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QACtD,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;QACxB,oBAAoB,EAAE,QAAQ,CAC5B,IAAI,CAAC;YACH,GAAG,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;YACvB,YAAY,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;YAChC,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;SAC7B,CAAC,CACH;QACD,gBAAgB,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpC,kBAAkB,EAAE,QAAQ,CAC1B,KAAK,CACH,IAAI,CAAC;YACH,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC9B,GAAG,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;YACvB,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC3B,KAAK,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;YACzB,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;SAC7B,CAAC,CACH,CACF;QACD,SAAS,EAAE,MAAM,EAAE;KACpB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import {\n array,\n number,\n optional,\n record,\n string,\n type,\n} from '@metamask/superstruct';\n\n/**\n * Superstruct schema for {@link VaultApyResponse}.\n *\n * Uses `type()` (loose validation) so that unknown fields returned by the\n * Veda API do not cause validation failures.\n *\n * Only `apy` and `timestamp` are required — all other fields are optional\n * because the Veda API omits some fields when the vault has no activity.\n */\nexport const VaultApyResponseStruct = type({\n Response: type({\n aggregation_period: optional(string()),\n apy: number(),\n chain_allocation: optional(record(string(), number())),\n fees: optional(number()),\n global_apy_breakdown: optional(\n type({\n fee: optional(number()),\n maturity_apy: optional(number()),\n real_apy: optional(number()),\n }),\n ),\n performance_fees: optional(number()),\n real_apy_breakdown: optional(\n array(\n type({\n allocation: optional(number()),\n apy: optional(number()),\n apy_net: optional(number()),\n chain: optional(string()),\n protocol: optional(string()),\n }),\n ),\n ),\n timestamp: string(),\n }),\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/money-account-controller",
3
- "version": "0.1.0-preview-aa31fa3",
3
+ "version": "0.1.0-preview-6e596eb",
4
4
  "description": "MetaMask Money account controller",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -72,6 +72,7 @@
72
72
  "@types/jest": "^29.5.14",
73
73
  "deepmerge": "^4.2.2",
74
74
  "jest": "^29.7.0",
75
+ "nock": "^13.3.1",
75
76
  "ts-jest": "^29.2.5",
76
77
  "tsx": "^4.20.5",
77
78
  "typedoc": "^0.25.13",