@herd-labs/sdk 0.4.0 → 0.5.1

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 (85) hide show
  1. package/dist/index.d.ts +20 -17
  2. package/dist/index.js +20 -17
  3. package/dist/src/config.d.ts +4 -4
  4. package/dist/src/config.js +2 -2
  5. package/dist/src/errors.d.ts +6 -0
  6. package/dist/src/errors.js +7 -1
  7. package/dist/src/live/ActionsServiceLive.d.ts +2 -2
  8. package/dist/src/live/ActionsServiceLive.js +7 -7
  9. package/dist/src/live/AdaptersServiceLive.d.ts +3 -3
  10. package/dist/src/live/AdaptersServiceLive.js +4 -4
  11. package/dist/src/live/AgentSafesServiceLive.d.ts +3 -3
  12. package/dist/src/live/AgentSafesServiceLive.js +4 -4
  13. package/dist/src/live/AgentWalletsServiceLive.d.ts +3 -3
  14. package/dist/src/live/AgentWalletsServiceLive.js +3 -3
  15. package/dist/src/live/AgentWorkflowsServiceLive.d.ts +3 -3
  16. package/dist/src/live/AgentWorkflowsServiceLive.js +8 -8
  17. package/dist/src/live/AuthServiceLive.d.ts +3 -3
  18. package/dist/src/live/AuthServiceLive.js +5 -5
  19. package/dist/src/live/BookmarksServiceLive.d.ts +2 -2
  20. package/dist/src/live/BookmarksServiceLive.js +6 -6
  21. package/dist/src/live/CodeBlocksServiceLive.d.ts +3 -3
  22. package/dist/src/live/CodeBlocksServiceLive.js +7 -7
  23. package/dist/src/live/CollectionsServiceLive.d.ts +3 -3
  24. package/dist/src/live/CollectionsServiceLive.js +4 -4
  25. package/dist/src/live/ContractsServiceLive.d.ts +3 -3
  26. package/dist/src/live/ContractsServiceLive.js +6 -6
  27. package/dist/src/live/DocsServiceLive.d.ts +3 -3
  28. package/dist/src/live/DocsServiceLive.js +3 -3
  29. package/dist/src/live/DoubleClickServiceLive.d.ts +9 -0
  30. package/dist/src/live/DoubleClickServiceLive.js +113 -0
  31. package/dist/src/live/GroupsServiceLive.d.ts +3 -3
  32. package/dist/src/live/GroupsServiceLive.js +7 -7
  33. package/dist/src/live/HalServiceLive.d.ts +3 -3
  34. package/dist/src/live/HalServiceLive.js +3 -3
  35. package/dist/src/live/TransactionsServiceLive.d.ts +3 -3
  36. package/dist/src/live/TransactionsServiceLive.js +4 -4
  37. package/dist/src/live/WalletsServiceLive.d.ts +3 -3
  38. package/dist/src/live/WalletsServiceLive.js +5 -5
  39. package/dist/src/live/http.d.ts +2 -2
  40. package/dist/src/live/http.js +2 -2
  41. package/dist/src/schemas/actions.d.ts +127 -59
  42. package/dist/src/schemas/actions.js +42 -42
  43. package/dist/src/schemas/adapters.d.ts +4 -4
  44. package/dist/src/schemas/adapters.js +3 -3
  45. package/dist/src/schemas/agent-wallets.d.ts +57 -37
  46. package/dist/src/schemas/agent-wallets.js +35 -35
  47. package/dist/src/schemas/agent-workflows.d.ts +35 -35
  48. package/dist/src/schemas/agent-workflows.js +19 -19
  49. package/dist/src/schemas/auth.d.ts +19 -19
  50. package/dist/src/schemas/auth.js +10 -10
  51. package/dist/src/schemas/bookmarks.d.ts +58 -36
  52. package/dist/src/schemas/bookmarks.js +34 -34
  53. package/dist/src/schemas/codeblocks.d.ts +89 -52
  54. package/dist/src/schemas/codeblocks.js +34 -34
  55. package/dist/src/schemas/collections.d.ts +76 -32
  56. package/dist/src/schemas/collections.js +23 -23
  57. package/dist/src/schemas/common.d.ts +8 -8
  58. package/dist/src/schemas/common.js +5 -5
  59. package/dist/src/schemas/contracts.d.ts +176 -61
  60. package/dist/src/schemas/contracts.js +47 -47
  61. package/dist/src/schemas/docs.d.ts +7 -7
  62. package/dist/src/schemas/docs.js +5 -5
  63. package/dist/src/schemas/doubleclick.d.ts +186 -0
  64. package/dist/src/schemas/doubleclick.js +22 -0
  65. package/dist/src/schemas/groups.d.ts +27 -27
  66. package/dist/src/schemas/groups.js +16 -16
  67. package/dist/src/schemas/hal.d.ts +64 -18
  68. package/dist/src/schemas/hal.js +18 -18
  69. package/dist/src/schemas/transactions.d.ts +264 -56
  70. package/dist/src/schemas/transactions.js +50 -50
  71. package/dist/src/schemas/wallets.d.ts +434 -84
  72. package/dist/src/schemas/wallets.js +114 -69
  73. package/dist/src/services/ActionsService.d.ts +2 -2
  74. package/dist/src/services/AgentSafesService.d.ts +4 -4
  75. package/dist/src/services/AgentWalletsService.d.ts +2 -2
  76. package/dist/src/services/AgentWorkflowsService.d.ts +8 -8
  77. package/dist/src/services/AuthService.d.ts +3 -3
  78. package/dist/src/services/BookmarksService.d.ts +2 -2
  79. package/dist/src/services/ContractsService.d.ts +5 -5
  80. package/dist/src/services/DoubleClickService.d.ts +63 -0
  81. package/dist/src/services/DoubleClickService.js +7 -0
  82. package/dist/src/services/GroupsService.d.ts +11 -11
  83. package/dist/src/services/TransactionsService.d.ts +4 -4
  84. package/dist/src/services/WalletsService.d.ts +4 -4
  85. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  import { ensureServiceError } from "../errors.js";
2
- import { BookmarkResponse, BookmarksList } from "../schemas/bookmarks.js";
2
+ import { BookmarkResponseSchema, BookmarksListSchema } from "../schemas/bookmarks.js";
3
3
  import { BookmarksService } from "../services/BookmarksService.js";
4
4
  import { authorizedClient, checkStatus, jsonBody, makeUrl } from "./http.js";
5
5
  import { Effect, Layer, pipe } from "effect";
@@ -18,7 +18,7 @@ const BookmarksServiceLive = Layer.effect(BookmarksService, Effect.gen(function*
18
18
  savedEvents: []
19
19
  },
20
20
  ...params.label === void 0 ? {} : { userLabel: params.label }
21
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponse)), Effect.mapError(ensureServiceError("Failed to add contract bookmark"))),
21
+ }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponseSchema)), Effect.mapError(ensureServiceError("Failed to add contract bookmark"))),
22
22
  addTransaction: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/bookmarks"), { body: jsonBody({
23
23
  objectType: "transaction",
24
24
  transactionHash: params.txHash,
@@ -28,13 +28,13 @@ const BookmarksServiceLive = Layer.effect(BookmarksService, Effect.gen(function*
28
28
  savedEvents: []
29
29
  },
30
30
  ...params.label === void 0 ? {} : { userLabel: params.label }
31
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponse)), Effect.mapError(ensureServiceError("Failed to add transaction bookmark"))),
31
+ }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponseSchema)), Effect.mapError(ensureServiceError("Failed to add transaction bookmark"))),
32
32
  addWallet: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/bookmarks"), { body: jsonBody({
33
33
  objectType: "wallet",
34
34
  walletAddress: params.address,
35
35
  details: {},
36
36
  ...params.label === void 0 ? {} : { userLabel: params.label }
37
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponse)), Effect.mapError(ensureServiceError("Failed to add wallet bookmark"))),
37
+ }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponseSchema)), Effect.mapError(ensureServiceError("Failed to add wallet bookmark"))),
38
38
  delete: (params) => pipe(client.del(makeUrl(baseUrl, "/v1/bookmarks"), { body: jsonBody({
39
39
  objectType: params.objectType,
40
40
  ...params.address === void 0 ? {} : { contractAddress: params.address },
@@ -42,7 +42,7 @@ const BookmarksServiceLive = Layer.effect(BookmarksService, Effect.gen(function*
42
42
  ...params.txHash === void 0 ? {} : { transactionHash: params.txHash },
43
43
  ...params.blockchain === void 0 ? {} : { blockchain: params.blockchain }
44
44
  }) }), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to delete bookmark"))),
45
- list: (params) => pipe(client.get(makeUrl(baseUrl, "/v1/bookmarks", { objectTypes: params?.objectTypes?.join(",") })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarksList)), Effect.mapError(ensureServiceError("Failed to list bookmarks"))),
45
+ list: (params) => pipe(client.get(makeUrl(baseUrl, "/v1/bookmarks", { objectTypes: params?.objectTypes?.join(",") })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarksListSchema)), Effect.mapError(ensureServiceError("Failed to list bookmarks"))),
46
46
  updateLabel: (params) => pipe(client.patch(makeUrl(baseUrl, "/v1/bookmarks/label"), { body: jsonBody({
47
47
  objectType: params.objectType,
48
48
  ...params.address === void 0 ? {} : { contractAddress: params.address },
@@ -50,7 +50,7 @@ const BookmarksServiceLive = Layer.effect(BookmarksService, Effect.gen(function*
50
50
  ...params.txHash === void 0 ? {} : { transactionHash: params.txHash },
51
51
  ...params.blockchain === void 0 ? {} : { blockchain: params.blockchain },
52
52
  userLabel: params.label
53
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponse)), Effect.mapError(ensureServiceError("Failed to update bookmark label")))
53
+ }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponseSchema)), Effect.mapError(ensureServiceError("Failed to update bookmark label")))
54
54
  };
55
55
  }));
56
56
 
@@ -1,9 +1,9 @@
1
- import { HerdConfig } from "../config.js";
1
+ import { HerdConfigService } from "../config.js";
2
2
  import { CodeBlocksService } from "../services/CodeBlocksService.js";
3
3
  import { Layer } from "effect";
4
- import * as effect_unstable_http_HttpClient8 from "effect/unstable/http/HttpClient";
4
+ import * as effect_unstable_http_HttpClient2 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/CodeBlocksServiceLive.d.ts
7
- declare const CodeBlocksServiceLive: Layer.Layer<CodeBlocksService, never, HerdConfig | effect_unstable_http_HttpClient8.HttpClient>;
7
+ declare const CodeBlocksServiceLive: Layer.Layer<CodeBlocksService, never, HerdConfigService | effect_unstable_http_HttpClient2.HttpClient>;
8
8
  //#endregion
9
9
  export { CodeBlocksServiceLive };
@@ -1,5 +1,5 @@
1
1
  import { CodeBlockNotFoundError, ServiceError, ensureServiceError } from "../errors.js";
2
- import { CodeBlockExecuteResponse, CodeBlocksSearchResponse, CreateCodeBlockResponse, CreateCodeVersionResponse, PublishCodeBlockResponse } from "../schemas/codeblocks.js";
2
+ import { CodeBlockExecuteResponseSchema, CodeBlocksSearchResponseSchema, CreateCodeBlockResponseSchema, CreateCodeVersionResponseSchema, PublishCodeBlockResponseSchema } from "../schemas/codeblocks.js";
3
3
  import { CodeBlocksService } from "../services/CodeBlocksService.js";
4
4
  import { authorizedClient, checkStatus, jsonBody, makeUrl } from "./http.js";
5
5
  import { Array, Effect, Layer, Option, pipe } from "effect";
@@ -13,20 +13,20 @@ const mapNotFound = (id) => Effect.catch((error) => {
13
13
  const CodeBlocksServiceLive = Layer.effect(CodeBlocksService, Effect.gen(function* () {
14
14
  const { baseUrl, client } = yield* authorizedClient;
15
15
  return {
16
- create: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/actions/code/definitions"), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreateCodeBlockResponse)), Effect.mapError(ensureServiceError("Failed to create code block"))),
17
- createCode: (definitionId, params) => pipe(client.post(makeUrl(baseUrl, `/v1/actions/code/definitions/${definitionId}/codes`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreateCodeVersionResponse)), Effect.mapError(ensureServiceError("Failed to create code version")), mapNotFound(definitionId)),
16
+ create: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/actions/code/definitions"), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreateCodeBlockResponseSchema)), Effect.mapError(ensureServiceError("Failed to create code block"))),
17
+ createCode: (definitionId, params) => pipe(client.post(makeUrl(baseUrl, `/v1/actions/code/definitions/${definitionId}/codes`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreateCodeVersionResponseSchema)), Effect.mapError(ensureServiceError("Failed to create code version")), mapNotFound(definitionId)),
18
18
  delete: (definitionId) => pipe(client.del(makeUrl(baseUrl, `/v1/actions/code/definitions/${definitionId}`)), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to delete code block")), mapNotFound(definitionId)),
19
- execute: (definitionId, codeId, params) => pipe(client.post(makeUrl(baseUrl, `/v1/actions/code/definitions/${definitionId}/codes/${codeId}/execute`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CodeBlockExecuteResponse)), Effect.mapError(ensureServiceError("Failed to execute code block")), mapNotFound(definitionId)),
19
+ execute: (definitionId, codeId, params) => pipe(client.post(makeUrl(baseUrl, `/v1/actions/code/definitions/${definitionId}/codes/${codeId}/execute`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CodeBlockExecuteResponseSchema)), Effect.mapError(ensureServiceError("Failed to execute code block")), mapNotFound(definitionId)),
20
20
  get: (id) => pipe(client.post(makeUrl(baseUrl, "/v1/actions/code/definitions/query"), { body: jsonBody({
21
21
  scope: "user",
22
22
  limit: 1,
23
23
  filters: { id }
24
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CodeBlocksSearchResponse)), Effect.mapError(ensureServiceError("Failed to search code blocks")), Effect.flatMap((response) => pipe(Array.head(response.items), Option.match({
24
+ }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CodeBlocksSearchResponseSchema)), Effect.mapError(ensureServiceError("Failed to search code blocks")), Effect.flatMap((response) => pipe(Array.head(response.items), Option.match({
25
25
  onNone: () => Effect.fail(new CodeBlockNotFoundError({ id })),
26
26
  onSome: Effect.succeed
27
27
  })))),
28
- publishCode: (definitionId, codeId, params) => pipe(client.post(makeUrl(baseUrl, `/v1/actions/code/definitions/${definitionId}/codes/${codeId}/publish`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(PublishCodeBlockResponse)), Effect.mapError(ensureServiceError("Failed to publish code block")), mapNotFound(definitionId)),
29
- search: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/actions/code/definitions/query"), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CodeBlocksSearchResponse)), Effect.mapError(ensureServiceError("Failed to search code blocks"))),
28
+ publishCode: (definitionId, codeId, params) => pipe(client.post(makeUrl(baseUrl, `/v1/actions/code/definitions/${definitionId}/codes/${codeId}/publish`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(PublishCodeBlockResponseSchema)), Effect.mapError(ensureServiceError("Failed to publish code block")), mapNotFound(definitionId)),
29
+ search: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/actions/code/definitions/query"), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CodeBlocksSearchResponseSchema)), Effect.mapError(ensureServiceError("Failed to search code blocks"))),
30
30
  updateCode: (definitionId, codeId, params) => pipe(client.put(makeUrl(baseUrl, `/v1/actions/code/definitions/${definitionId}/codes/${codeId}`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to update code")), mapNotFound(definitionId)),
31
31
  updateMetadata: (definitionId, params) => pipe(client.put(makeUrl(baseUrl, `/v1/actions/code/definitions/${definitionId}`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to update code block metadata")), mapNotFound(definitionId))
32
32
  };
@@ -1,9 +1,9 @@
1
- import { HerdConfig } from "../config.js";
1
+ import { HerdConfigService } from "../config.js";
2
2
  import { CollectionsService } from "../services/CollectionsService.js";
3
3
  import { Layer } from "effect";
4
- import * as effect_unstable_http_HttpClient9 from "effect/unstable/http/HttpClient";
4
+ import * as effect_unstable_http_HttpClient1 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/CollectionsServiceLive.d.ts
7
- declare const CollectionsServiceLive: Layer.Layer<CollectionsService, never, HerdConfig | effect_unstable_http_HttpClient9.HttpClient>;
7
+ declare const CollectionsServiceLive: Layer.Layer<CollectionsService, never, HerdConfigService | effect_unstable_http_HttpClient1.HttpClient>;
8
8
  //#endregion
9
9
  export { CollectionsServiceLive };
@@ -1,5 +1,5 @@
1
1
  import { CollectionNotFoundError, ServiceError, ensureServiceError } from "../errors.js";
2
- import { Collection, CollectionsSearchResponse, CreateCollectionResponse } from "../schemas/collections.js";
2
+ import { CollectionSchema, CollectionsSearchResponseSchema, CreateCollectionResponseSchema } from "../schemas/collections.js";
3
3
  import { CollectionsService } from "../services/CollectionsService.js";
4
4
  import { authorizedClient, checkStatus, jsonBody, makeUrl } from "./http.js";
5
5
  import { Effect, Layer, pipe } from "effect";
@@ -13,9 +13,9 @@ const mapNotFound = (id) => Effect.catch((error) => {
13
13
  const CollectionsServiceLive = Layer.effect(CollectionsService, Effect.gen(function* () {
14
14
  const { baseUrl, client } = yield* authorizedClient;
15
15
  return {
16
- create: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/collections"), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreateCollectionResponse)), Effect.mapError(ensureServiceError("Failed to create collection"))),
17
- get: (collectionId) => pipe(client.get(makeUrl(baseUrl, `/v1/collections/${collectionId}`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(Collection)), Effect.mapError(ensureServiceError("Failed to get collection")), mapNotFound(collectionId)),
18
- search: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/collections/query"), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CollectionsSearchResponse)), Effect.mapError(ensureServiceError("Failed to search collections"))),
16
+ create: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/collections"), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreateCollectionResponseSchema)), Effect.mapError(ensureServiceError("Failed to create collection"))),
17
+ get: (collectionId) => pipe(client.get(makeUrl(baseUrl, `/v1/collections/${collectionId}`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CollectionSchema)), Effect.mapError(ensureServiceError("Failed to get collection")), mapNotFound(collectionId)),
18
+ search: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/collections/query"), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CollectionsSearchResponseSchema)), Effect.mapError(ensureServiceError("Failed to search collections"))),
19
19
  update: (collectionId, params) => pipe(client.patch(makeUrl(baseUrl, `/v1/collections/${collectionId}`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to update collection")), mapNotFound(collectionId))
20
20
  };
21
21
  }));
@@ -1,9 +1,9 @@
1
- import { HerdConfig } from "../config.js";
1
+ import { HerdConfigService } from "../config.js";
2
2
  import { ContractsService } from "../services/ContractsService.js";
3
3
  import { Layer } from "effect";
4
- import * as effect_unstable_http_HttpClient7 from "effect/unstable/http/HttpClient";
4
+ import * as effect_unstable_http_HttpClient12 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/ContractsServiceLive.d.ts
7
- declare const ContractsServiceLive: Layer.Layer<ContractsService, never, HerdConfig | effect_unstable_http_HttpClient7.HttpClient>;
7
+ declare const ContractsServiceLive: Layer.Layer<ContractsService, never, HerdConfigService | effect_unstable_http_HttpClient12.HttpClient>;
8
8
  //#endregion
9
9
  export { ContractsServiceLive };
@@ -1,6 +1,6 @@
1
1
  import { ensureServiceError } from "../errors.js";
2
- import { ContractDiff, ContractMetadata, GetContractCodeResponse } from "../schemas/contracts.js";
3
- import { DeployedContracts } from "../schemas/wallets.js";
2
+ import { ContractDiffSchema, ContractMetadataSchema, GetContractCodeResponseSchema } from "../schemas/contracts.js";
3
+ import { DeployedContractsSchema } from "../schemas/wallets.js";
4
4
  import { ContractsService } from "../services/ContractsService.js";
5
5
  import { authorizedClient, checkStatus, jsonBody, makeUrl } from "./http.js";
6
6
  import { Effect, Layer, pipe } from "effect";
@@ -14,16 +14,16 @@ const ContractsServiceLive = Layer.effect(ContractsService, Effect.gen(function*
14
14
  contractAddress: address,
15
15
  blockchain,
16
16
  ...params
17
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ContractDiff)), Effect.mapError(ensureServiceError("Failed to diff contract versions"))),
17
+ }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ContractDiffSchema)), Effect.mapError(ensureServiceError("Failed to diff contract versions"))),
18
18
  getContractCode: (blockchain, params) => pipe(client.post(makeUrl(baseUrl, "/v1/contracts/code/query"), { body: jsonBody({
19
19
  blockchain,
20
20
  ...params
21
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(GetContractCodeResponse)), Effect.mapError(ensureServiceError("Failed to get contract code"))),
22
- getDeployedContracts: (blockchain, address, params) => pipe(client.get(makeUrl(baseUrl, `/v1/wallets/${blockchain}/${address}/created_contracts`, params)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(DeployedContracts)), Effect.mapError(ensureServiceError("Failed to get deployed contracts"))),
21
+ }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(GetContractCodeResponseSchema)), Effect.mapError(ensureServiceError("Failed to get contract code"))),
22
+ getDeployedContracts: (blockchain, address, params) => pipe(client.get(makeUrl(baseUrl, `/v1/wallets/${blockchain}/${address}/created_contracts`, params)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(DeployedContractsSchema)), Effect.mapError(ensureServiceError("Failed to get deployed contracts"))),
23
23
  getMetadata: (address, blockchain) => pipe(client.post(makeUrl(baseUrl, "/v1/contracts/metadata_enriched"), { body: jsonBody({
24
24
  contractAddress: address,
25
25
  blockchain
26
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ContractMetadata)), Effect.mapError(ensureServiceError("Failed to get contract metadata")))
26
+ }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ContractMetadataSchema)), Effect.mapError(ensureServiceError("Failed to get contract metadata")))
27
27
  };
28
28
  }));
29
29
 
@@ -1,9 +1,9 @@
1
- import { HerdConfig } from "../config.js";
1
+ import { HerdConfigService } from "../config.js";
2
2
  import { DocsService } from "../services/DocsService.js";
3
3
  import { Layer } from "effect";
4
- import * as effect_unstable_http_HttpClient11 from "effect/unstable/http/HttpClient";
4
+ import * as effect_unstable_http_HttpClient13 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/DocsServiceLive.d.ts
7
- declare const DocsServiceLive: Layer.Layer<DocsService, never, HerdConfig | effect_unstable_http_HttpClient11.HttpClient>;
7
+ declare const DocsServiceLive: Layer.Layer<DocsService, never, HerdConfigService | effect_unstable_http_HttpClient13.HttpClient>;
8
8
  //#endregion
9
9
  export { DocsServiceLive };
@@ -1,5 +1,5 @@
1
1
  import { DocNotFoundError, ensureServiceError } from "../errors.js";
2
- import { DocContent, DocEntry } from "../schemas/docs.js";
2
+ import { DocContentSchema, DocEntrySchema } from "../schemas/docs.js";
3
3
  import { DocsService } from "../services/DocsService.js";
4
4
  import { authorizedClient, checkStatus, makeUrl } from "./http.js";
5
5
  import { Effect, Layer, Schema, pipe } from "effect";
@@ -9,13 +9,13 @@ import { HttpClientResponse } from "effect/unstable/http";
9
9
  const DocsServiceLive = Layer.effect(DocsService, Effect.gen(function* () {
10
10
  const { baseUrl, client } = yield* authorizedClient;
11
11
  return {
12
- list: pipe(client.get(makeUrl(baseUrl, "/v1/docs")), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(Schema.Array(DocEntry))), Effect.mapError(ensureServiceError("Failed to list docs"))),
12
+ list: pipe(client.get(makeUrl(baseUrl, "/v1/docs")), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(Schema.Array(DocEntrySchema))), Effect.mapError(ensureServiceError("Failed to list docs"))),
13
13
  read: (docId) => Effect.gen(function* () {
14
14
  const response = yield* pipe(client.get(makeUrl(baseUrl, `/v1/docs/${encodeURIComponent(docId)}`)), Effect.flatMap(checkStatus), Effect.mapError((error) => {
15
15
  const wrapped = ensureServiceError("Failed to read doc")(error);
16
16
  return wrapped.metadata["status"] === 404 ? new DocNotFoundError({ docId }) : wrapped;
17
17
  }));
18
- return yield* pipe(HttpClientResponse.schemaBodyJson(DocContent)(response), Effect.mapError((error) => ensureServiceError("Failed to parse doc content")(error)));
18
+ return yield* pipe(HttpClientResponse.schemaBodyJson(DocContentSchema)(response), Effect.mapError((error) => ensureServiceError("Failed to parse doc content")(error)));
19
19
  })
20
20
  };
21
21
  }));
@@ -0,0 +1,9 @@
1
+ import { HerdConfigService } from "../config.js";
2
+ import { DoubleClickService } from "../services/DoubleClickService.js";
3
+ import { Layer } from "effect";
4
+ import * as effect_unstable_http_HttpClient8 from "effect/unstable/http/HttpClient";
5
+
6
+ //#region src/live/DoubleClickServiceLive.d.ts
7
+ declare const DoubleClickServiceLive: Layer.Layer<DoubleClickService, never, HerdConfigService | effect_unstable_http_HttpClient8.HttpClient>;
8
+ //#endregion
9
+ export { DoubleClickServiceLive };
@@ -0,0 +1,113 @@
1
+ import { ensureServiceError } from "../errors.js";
2
+ import { DoubleClickJsonResponseSchema } from "../schemas/doubleclick.js";
3
+ import { DoubleClickService } from "../services/DoubleClickService.js";
4
+ import { authorizedClient, checkStatus, jsonBody, makeUrl } from "./http.js";
5
+ import { Effect, Layer, pipe } from "effect";
6
+ import { HttpClientResponse } from "effect/unstable/http";
7
+
8
+ //#region src/live/DoubleClickServiceLive.ts
9
+ const decodeJson = HttpClientResponse.schemaBodyJson(DoubleClickJsonResponseSchema);
10
+ const reviewPath = (target) => `/v1/balance-graph/${target}-versions`;
11
+ const reviewIdsKey = (target) => `${target}VersionIds`;
12
+ const DoubleClickServiceLive = Layer.effect(DoubleClickService, Effect.gen(function* () {
13
+ const { baseUrl, client } = yield* authorizedClient;
14
+ const getJson = (path, query, message) => pipe(client.get(makeUrl(baseUrl, path, query)), Effect.flatMap(checkStatus), Effect.flatMap(decodeJson), Effect.mapError(ensureServiceError(message)));
15
+ const postJson = (path, body, message) => pipe(client.post(makeUrl(baseUrl, path), { body: jsonBody(body) }), Effect.flatMap(checkStatus), Effect.flatMap(decodeJson), Effect.mapError(ensureServiceError(message)));
16
+ const postJsonQuery = (path, query, body, message) => pipe(client.post(makeUrl(baseUrl, path, query), { body: jsonBody(body) }), Effect.flatMap(checkStatus), Effect.flatMap(decodeJson), Effect.mapError(ensureServiceError(message)));
17
+ const patchJson = (path, body, message) => pipe(client.patch(makeUrl(baseUrl, path), { body: jsonBody(body) }), Effect.flatMap(checkStatus), Effect.flatMap(decodeJson), Effect.mapError(ensureServiceError(message)));
18
+ const deleteJson = (path, message) => pipe(client.del(makeUrl(baseUrl, path)), Effect.flatMap(checkStatus), Effect.flatMap(decodeJson), Effect.mapError(ensureServiceError(message)));
19
+ return {
20
+ addIssuerToken: (params) => postJson(`/v1/display-tokens/issuers/${params.slug}/add-token`, {
21
+ nodeId: params.nodeId,
22
+ order: params.order
23
+ }, "Failed to add issuer token"),
24
+ addSlot: (params) => postJson(`/v1/param-queries/slots/${params.targetType}/${params.targetId}`, {
25
+ slotName: params.slotName,
26
+ queryId: params.queryId,
27
+ methodology: params.methodology
28
+ }, "Failed to add slot"),
29
+ approveVersion: (params) => patchJson(`${reviewPath(params.target)}/${params.versionId}/approve`, { notes: params.notes }, "Failed to approve graph version"),
30
+ bulkApproveVersions: (params) => postJson(`${reviewPath(params.target)}/bulk-approve`, {
31
+ [reviewIdsKey(params.target)]: params.versionIds,
32
+ notes: params.notes
33
+ }, "Failed to bulk approve graph versions"),
34
+ bulkRejectVersions: (params) => postJson(`${reviewPath(params.target)}/bulk-reject`, {
35
+ [reviewIdsKey(params.target)]: params.versionIds,
36
+ notes: params.notes
37
+ }, "Failed to bulk reject graph versions"),
38
+ convertSlotToFixed: (params) => patchJson(`/v1/param-queries/slots/${params.targetType}/${params.targetId}/${params.slotName}/to-fixed`, {
39
+ fixedValue: params.fixedValue,
40
+ methodology: params.methodology
41
+ }, "Failed to convert slot to fixed"),
42
+ convertSlotToNotPriced: (params) => patchJson(`/v1/param-queries/slots/${params.targetType}/${params.targetId}/${params.slotName}/to-not-priced`, { methodology: params.methodology }, "Failed to convert slot to not priced"),
43
+ createIssuer: (params) => postJson("/v1/display-tokens/issuers", params, "Failed to create issuer"),
44
+ getAssembledNode: (params) => getJson(`/v1/balance-graph/nodes/${params.nodeId}/assembled`, void 0, "Failed to get assembled node"),
45
+ getIssuer: (slug) => getJson(`/v1/display-tokens/issuers/${slug}`, void 0, "Failed to get issuer"),
46
+ getLogo: (params) => getJson("/v1/display-tokens/logos", params, "Failed to get logo"),
47
+ getLogoBatch: (params) => postJson("/v1/display-tokens/logos/batch", params, "Failed to get logo batch"),
48
+ getLogoBatchMap: (params) => postJson("/v1/display-tokens/logos/batch-map", params, "Failed to get logo batch map"),
49
+ getNode: (params) => getJson(`/v1/balance-graph/nodes/${params.nodeId}`, {
50
+ versionOverride: params.versionOverride,
51
+ adminLive: params.adminLive
52
+ }, "Failed to get graph node"),
53
+ getNodeByIdentity: (params) => getJson("/v1/balance-graph/nodes", { identityKey: params.identityKey }, "Failed to get graph node by identity"),
54
+ getNodeWithCounts: (params) => getJson(`/v1/balance-graph/nodes/${params.nodeId}/with-counts`, { adminLive: params.adminLive }, "Failed to get graph node with counts"),
55
+ getResearchRun: (runId) => getJson(`/v1/balance-graph-research/runs/${runId}`, void 0, "Failed to get research run"),
56
+ getResearchRunWithPins: (runId) => getJson(`/v1/balance-graph-research/runs/${runId}/with-pins`, void 0, "Failed to get research run pins"),
57
+ getTokenByChainAndAddress: (params) => getJson("/v1/display-tokens/tokens", params, "Failed to get token"),
58
+ getTokenMetrics: (nodeId) => getJson(`/v1/display-tokens/tokens/${nodeId}/metrics`, void 0, "Failed to get token metrics"),
59
+ getTokenMetricsBatch: (nodeIds) => postJson("/v1/display-tokens/tokens/metrics/batch", { tokenNodeIds: nodeIds }, "Failed to get token metrics"),
60
+ integrityCheck: (params) => getJson(`/v1/integrity/${params.key}`, { includeDrafts: params.includeDrafts }, "Failed to run integrity check"),
61
+ integritySummary: (params) => getJson("/v1/integrity/summary", { includeDrafts: params?.includeDrafts }, "Failed to get integrity summary"),
62
+ listCuratedTokens: (params) => getJson("/v1/display-tokens/curated", params, "Failed to list curated tokens"),
63
+ listEdgesForNode: (params) => getJson(`/v1/balance-graph/nodes/${params.nodeId}/edges`, { adminLive: params.adminLive }, "Failed to list graph node edges"),
64
+ listIssuerTokenLinks: getJson("/v1/display-tokens/issuer-token-links", void 0, "Failed to list issuer token links"),
65
+ listIssuerTokens: (params) => getJson(`/v1/display-tokens/issuers/${params.slug}/tokens`, { include: params.include }, "Failed to list issuer tokens"),
66
+ listIssuers: getJson("/v1/display-tokens/issuers", void 0, "Failed to list issuers"),
67
+ listRecentResearchRuns: getJson("/v1/balance-graph-research/runs/recent", void 0, "Failed to list recent research runs"),
68
+ listRecentResearchRunsWithStats: getJson("/v1/balance-graph-research/runs/recent-with-stats", void 0, "Failed to list recent research runs with stats"),
69
+ listResearchRunFindings: (runId) => getJson(`/v1/balance-graph-research/runs/${runId}/findings`, void 0, "Failed to list research findings"),
70
+ listResearchRuns: (params) => getJson("/v1/balance-graph-research/runs", params, "Failed to list research runs"),
71
+ markResearchRunCompleted: (runId) => postJson(`/v1/balance-graph-research/runs/${runId}/mark-completed`, {}, "Failed to mark research run complete"),
72
+ markResearchRunFailed: (params) => postJson(`/v1/balance-graph-research/runs/${params.runId}/mark-failed`, { reason: params.reason }, "Failed to mark research run failed"),
73
+ refreshAllCuratedMetrics: (params = {}) => postJson("/v1/display-tokens/metrics/refresh-all", params, "Failed to refresh all curated metrics"),
74
+ refreshStaleSlotsForExpansion: (params) => postJson("/v1/param-queries/refresh-stale-slots/expansion", params, "Failed to refresh expansion slots"),
75
+ refreshStaleSlotsForNode: (params) => postJson(`/v1/param-queries/nodes/${params.nodeId}/refresh-stale-slots`, {
76
+ staleMs: params.staleMs,
77
+ adminLive: params.adminLive
78
+ }, "Failed to refresh node slots"),
79
+ refreshTokenMetrics: (params) => postJsonQuery(`/v1/display-tokens/tokens/${params.nodeId}/refresh-metrics`, {
80
+ side: params.side,
81
+ maxAgeMs: params.maxAgeMs
82
+ }, {}, "Failed to refresh token metrics"),
83
+ registerToken: (params) => postJson("/v1/display-tokens/register", params, "Failed to register token"),
84
+ removeSlot: (params) => deleteJson(`/v1/param-queries/slots/${params.targetType}/${params.targetId}/${params.slotName}`, "Failed to remove slot"),
85
+ revertVersionToDraft: (params) => patchJson(`${reviewPath(params.target)}/${params.versionId}/revert-to-draft`, {}, "Failed to revert graph version to draft"),
86
+ runAccountingCheckForNode: (params) => postJson("/v1/accounting-checks/node", params, "Failed to run accounting check"),
87
+ runAccountingCheckForNodes: (params) => postJson("/v1/accounting-checks/nodes", params, "Failed to run accounting checks"),
88
+ setCurated: (params) => patchJson(`/v1/display-tokens/${params.nodeId}/curated`, { curated: params.curated }, "Failed to set curated"),
89
+ setLogo: (params) => patchJson(`/v1/balance-graph/nodes/${params.nodeId}/logo`, { logoUrl: params.logoUrl }, "Failed to set logo"),
90
+ setPrimaryToken: (params) => postJson(`/v1/display-tokens/${params.nodeId}/set-primary`, { primaryTokenId: params.primaryTokenId }, "Failed to set primary token"),
91
+ setSlotMethodology: (params) => patchJson(`/v1/param-queries/slots/${params.targetType}/${params.targetId}/${params.slotName}/methodology`, { methodology: params.methodology }, "Failed to set slot methodology"),
92
+ startResearchRun: (params) => postJson("/v1/balance-graph-research/runs", params, "Failed to start research run"),
93
+ submitResearchGraph: (params) => postJson(`/v1/balance-graph-research/runs/${params.runId}/graph`, {
94
+ graph: params.graph,
95
+ tools: params.tools,
96
+ status: params.status
97
+ }, "Failed to submit research graph"),
98
+ traverseDeep: (params) => postJson("/v1/balance-graph/traversal/deep", params, "Failed to traverse graph"),
99
+ traverseDirectional: (params) => postJson("/v1/balance-graph/traversal/directional", params, "Failed to traverse directional graph"),
100
+ updateIssuer: (params) => {
101
+ const { slug, ...body } = params;
102
+ return patchJson(`/v1/display-tokens/issuers/${slug}`, body, "Failed to update issuer");
103
+ },
104
+ upsertSideMetrics: (params) => postJson(`/v1/display-tokens/tokens/${params.nodeId}/metrics/upsert-side`, {
105
+ side: params.side,
106
+ metrics: params.metrics,
107
+ reason: params.reason
108
+ }, "Failed to upsert token side metrics")
109
+ };
110
+ }));
111
+
112
+ //#endregion
113
+ export { DoubleClickServiceLive };
@@ -1,9 +1,9 @@
1
- import { HerdConfig } from "../config.js";
1
+ import { HerdConfigService } from "../config.js";
2
2
  import { GroupsService } from "../services/GroupsService.js";
3
3
  import { Layer } from "effect";
4
- import * as effect_unstable_http_HttpClient12 from "effect/unstable/http/HttpClient";
4
+ import * as effect_unstable_http_HttpClient7 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/GroupsServiceLive.d.ts
7
- declare const GroupsServiceLive: Layer.Layer<GroupsService, never, HerdConfig | effect_unstable_http_HttpClient12.HttpClient>;
7
+ declare const GroupsServiceLive: Layer.Layer<GroupsService, never, HerdConfigService | effect_unstable_http_HttpClient7.HttpClient>;
8
8
  //#endregion
9
9
  export { GroupsServiceLive };
@@ -1,5 +1,5 @@
1
1
  import { ServiceError, ensureServiceError } from "../errors.js";
2
- import { CreateGroupResponse, EditGroupMetadataResponse, GroupDetails, ListGroupsResponse, ProposalResponse } from "../schemas/groups.js";
2
+ import { CreateGroupResponseSchema, EditGroupMetadataResponseSchema, GroupDetailsSchema, ListGroupsResponseSchema, ProposalResponseSchema } from "../schemas/groups.js";
3
3
  import { GroupNotFoundError, GroupsService } from "../services/GroupsService.js";
4
4
  import { authorizedClient, checkStatus, jsonBody, makeUrl } from "./http.js";
5
5
  import { Effect, Layer, pipe } from "effect";
@@ -13,12 +13,12 @@ const mapNotFound = (groupId) => Effect.catch((error) => {
13
13
  const GroupsServiceLive = Layer.effect(GroupsService, Effect.gen(function* () {
14
14
  const { baseUrl, client } = yield* authorizedClient;
15
15
  return {
16
- create: ({ params }) => pipe(client.post(makeUrl(baseUrl, "/v1/groups"), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreateGroupResponse)), Effect.mapError(ensureServiceError("Failed to create group"))),
17
- editMetadata: ({ groupId, params }) => pipe(client.patch(makeUrl(baseUrl, `/v1/groups/${groupId}`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(EditGroupMetadataResponse)), Effect.mapError(ensureServiceError("Failed to edit group metadata")), mapNotFound(groupId)),
18
- get: ({ groupId }) => pipe(client.get(makeUrl(baseUrl, `/v1/groups/${groupId}`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(GroupDetails)), Effect.mapError(ensureServiceError("Failed to get group")), mapNotFound(groupId)),
19
- list: pipe(client.get(makeUrl(baseUrl, "/v1/groups")), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ListGroupsResponse)), Effect.mapError(ensureServiceError("Failed to list groups"))),
20
- proposeMemberChange: ({ groupId, params }) => pipe(client.post(makeUrl(baseUrl, `/v1/groups/${groupId}/proposals/member`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ProposalResponse)), Effect.mapError(ensureServiceError("Failed to propose member change")), mapNotFound(groupId)),
21
- proposeQuorumChange: ({ groupId, params }) => pipe(client.post(makeUrl(baseUrl, `/v1/groups/${groupId}/proposals/quorum`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ProposalResponse)), Effect.mapError(ensureServiceError("Failed to propose quorum change")), mapNotFound(groupId))
16
+ create: ({ params }) => pipe(client.post(makeUrl(baseUrl, "/v1/groups"), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreateGroupResponseSchema)), Effect.mapError(ensureServiceError("Failed to create group"))),
17
+ editMetadata: ({ groupId, params }) => pipe(client.patch(makeUrl(baseUrl, `/v1/groups/${groupId}`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(EditGroupMetadataResponseSchema)), Effect.mapError(ensureServiceError("Failed to edit group metadata")), mapNotFound(groupId)),
18
+ get: ({ groupId }) => pipe(client.get(makeUrl(baseUrl, `/v1/groups/${groupId}`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(GroupDetailsSchema)), Effect.mapError(ensureServiceError("Failed to get group")), mapNotFound(groupId)),
19
+ list: pipe(client.get(makeUrl(baseUrl, "/v1/groups")), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ListGroupsResponseSchema)), Effect.mapError(ensureServiceError("Failed to list groups"))),
20
+ proposeMemberChange: ({ groupId, params }) => pipe(client.post(makeUrl(baseUrl, `/v1/groups/${groupId}/proposals/member`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ProposalResponseSchema)), Effect.mapError(ensureServiceError("Failed to propose member change")), mapNotFound(groupId)),
21
+ proposeQuorumChange: ({ groupId, params }) => pipe(client.post(makeUrl(baseUrl, `/v1/groups/${groupId}/proposals/quorum`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ProposalResponseSchema)), Effect.mapError(ensureServiceError("Failed to propose quorum change")), mapNotFound(groupId))
22
22
  };
23
23
  }));
24
24
 
@@ -1,9 +1,9 @@
1
- import { HerdConfig } from "../config.js";
1
+ import { HerdConfigService } from "../config.js";
2
2
  import { HalService } from "../services/HalService.js";
3
3
  import { Layer } from "effect";
4
- import * as effect_unstable_http_HttpClient13 from "effect/unstable/http/HttpClient";
4
+ import * as effect_unstable_http_HttpClient11 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/HalServiceLive.d.ts
7
- declare const HalServiceLive: Layer.Layer<HalService, never, HerdConfig | effect_unstable_http_HttpClient13.HttpClient>;
7
+ declare const HalServiceLive: Layer.Layer<HalService, never, HerdConfigService | effect_unstable_http_HttpClient11.HttpClient>;
8
8
  //#endregion
9
9
  export { HalServiceLive };
@@ -1,5 +1,5 @@
1
1
  import { ServiceError, SimulationError, ensureServiceError } from "../errors.js";
2
- import { EvaluateExistingResponse, EvaluateResponse } from "../schemas/hal.js";
2
+ import { EvaluateExistingResponseSchema, EvaluateResponseSchema } from "../schemas/hal.js";
3
3
  import { HalService } from "../services/HalService.js";
4
4
  import { authorizedClient, checkStatus, jsonBody, makeUrl } from "./http.js";
5
5
  import { Effect, Layer, pipe } from "effect";
@@ -15,8 +15,8 @@ const mapSimulationError = Effect.catch((error) => {
15
15
  });
16
16
  const HalServiceLive = Layer.effect(HalService, Effect.gen(function* () {
17
17
  const { baseUrl, client } = yield* authorizedClient;
18
- const callEvaluate = (body) => pipe(client.post(makeUrl(baseUrl, "/v1/actions/executions/evaluate"), { body: jsonBody(body) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(EvaluateResponse)), Effect.mapError(ensureServiceError("Failed to evaluate expression")), mapSimulationError);
19
- const callEvaluateExisting = (body) => pipe(client.post(makeUrl(baseUrl, "/v1/actions/executions/evaluate/existing"), { body: jsonBody(body) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(EvaluateExistingResponse)), Effect.mapError(ensureServiceError("Failed to evaluate existing action")), mapSimulationError);
18
+ const callEvaluate = (body) => pipe(client.post(makeUrl(baseUrl, "/v1/actions/executions/evaluate"), { body: jsonBody(body) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(EvaluateResponseSchema)), Effect.mapError(ensureServiceError("Failed to evaluate expression")), mapSimulationError);
19
+ const callEvaluateExisting = (body) => pipe(client.post(makeUrl(baseUrl, "/v1/actions/executions/evaluate/existing"), { body: jsonBody(body) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(EvaluateExistingResponseSchema)), Effect.mapError(ensureServiceError("Failed to evaluate existing action")), mapSimulationError);
20
20
  return {
21
21
  evaluate: (params) => callEvaluate({
22
22
  expression: params.expression,
@@ -1,9 +1,9 @@
1
- import { HerdConfig } from "../config.js";
1
+ import { HerdConfigService } from "../config.js";
2
2
  import { TransactionsService } from "../services/TransactionsService.js";
3
3
  import { Layer } from "effect";
4
- import * as effect_unstable_http_HttpClient4 from "effect/unstable/http/HttpClient";
4
+ import * as effect_unstable_http_HttpClient14 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/TransactionsServiceLive.d.ts
7
- declare const TransactionsServiceLive: Layer.Layer<TransactionsService, never, HerdConfig | effect_unstable_http_HttpClient4.HttpClient>;
7
+ declare const TransactionsServiceLive: Layer.Layer<TransactionsService, never, HerdConfigService | effect_unstable_http_HttpClient14.HttpClient>;
8
8
  //#endregion
9
9
  export { TransactionsServiceLive };
@@ -1,5 +1,5 @@
1
1
  import { ensureServiceError } from "../errors.js";
2
- import { LatestEventTransactions, LatestFunctionTransactions, TransactionQueryResponse } from "../schemas/transactions.js";
2
+ import { LatestEventTransactionsSchema, LatestFunctionTransactionsSchema, TransactionQueryResponseSchema } from "../schemas/transactions.js";
3
3
  import { TransactionsService } from "../services/TransactionsService.js";
4
4
  import { authorizedClient, checkStatus, makeUrl } from "./http.js";
5
5
  import { Effect, Layer, Option, Record, pipe } from "effect";
@@ -31,15 +31,15 @@ const TransactionsServiceLive = Layer.effect(TransactionsService, Effect.gen(fun
31
31
  name: filter.name,
32
32
  signature: filter.signature
33
33
  })
34
- })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(LatestEventTransactions)), Effect.mapError(ensureServiceError("Failed to get latest event transactions"))),
34
+ })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(LatestEventTransactionsSchema)), Effect.mapError(ensureServiceError("Failed to get latest event transactions"))),
35
35
  getLatestFunctionTransactions: (blockchain, address, filter, params) => pipe(client.get(makeUrl(baseUrl, `/v1/contracts/${blockchain}/${address}/latest_function_transactions`, {
36
36
  ...latestTxParamsToSnakeCaseQuery(params),
37
37
  ...toOptionalQuery({
38
38
  name: filter.name,
39
39
  signature: filter.signature
40
40
  })
41
- })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(LatestFunctionTransactions)), Effect.mapError(ensureServiceError("Failed to get latest function transactions"))),
42
- getTransaction: (blockchain, txHash) => pipe(client.get(makeUrl(baseUrl, `/v1/transactions/${blockchain}/${txHash}`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(TransactionQueryResponse)), Effect.mapError(ensureServiceError("Failed to get transaction")))
41
+ })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(LatestFunctionTransactionsSchema)), Effect.mapError(ensureServiceError("Failed to get latest function transactions"))),
42
+ getTransaction: (blockchain, txHash) => pipe(client.get(makeUrl(baseUrl, `/v1/transactions/${blockchain}/${txHash}`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(TransactionQueryResponseSchema)), Effect.mapError(ensureServiceError("Failed to get transaction")))
43
43
  };
44
44
  }));
45
45
 
@@ -1,9 +1,9 @@
1
- import { HerdConfig } from "../config.js";
1
+ import { HerdConfigService } from "../config.js";
2
2
  import { WalletsService } from "../services/WalletsService.js";
3
3
  import { Layer } from "effect";
4
- import * as effect_unstable_http_HttpClient5 from "effect/unstable/http/HttpClient";
4
+ import * as effect_unstable_http_HttpClient0 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/WalletsServiceLive.d.ts
7
- declare const WalletsServiceLive: Layer.Layer<WalletsService, never, HerdConfig | effect_unstable_http_HttpClient5.HttpClient>;
7
+ declare const WalletsServiceLive: Layer.Layer<WalletsService, never, HerdConfigService | effect_unstable_http_HttpClient0.HttpClient>;
8
8
  //#endregion
9
9
  export { WalletsServiceLive };
@@ -1,5 +1,5 @@
1
1
  import { ensureServiceError } from "../errors.js";
2
- import { DeployedContracts, TokenActivity, TransactionActivity, WalletOverview } from "../schemas/wallets.js";
2
+ import { DeployedContractsSchema, TokenActivitySchema, TransactionActivitySchema, WalletOverviewSchema } from "../schemas/wallets.js";
3
3
  import { WalletsService } from "../services/WalletsService.js";
4
4
  import { authorizedClient, checkStatus, jsonBody, makeUrl } from "./http.js";
5
5
  import { Effect, Layer, Option, Record, pipe } from "effect";
@@ -15,13 +15,13 @@ const WalletsServiceLive = Layer.effect(WalletsService, Effect.gen(function* ()
15
15
  after_timestamp: params?.afterTimestamp,
16
16
  before_blocknumber: params?.beforeBlocknumber,
17
17
  after_blocknumber: params?.afterBlocknumber
18
- })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(DeployedContracts)), Effect.mapError(ensureServiceError("Failed to get deployed contracts"))),
18
+ })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(DeployedContractsSchema)), Effect.mapError(ensureServiceError("Failed to get deployed contracts"))),
19
19
  getOverview: (blockchain, address, params) => pipe(client.get(makeUrl(baseUrl, `/v1/wallets/${blockchain}/${address}/overview`, {
20
20
  before_timestamp: params?.beforeTimestamp,
21
21
  after_timestamp: params?.afterTimestamp,
22
22
  before_blocknumber: params?.beforeBlocknumber,
23
23
  after_blocknumber: params?.afterBlocknumber
24
- })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(WalletOverview)), Effect.mapError(ensureServiceError("Failed to get wallet overview"))),
24
+ })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(WalletOverviewSchema)), Effect.mapError(ensureServiceError("Failed to get wallet overview"))),
25
25
  getTokenActivity: (blockchain, address, tokenAddress, params) => pipe(client.get(makeUrl(baseUrl, `/v1/wallets/${blockchain}/${address}/tokens/${tokenAddress}`, {
26
26
  page: params?.page,
27
27
  before_timestamp: params?.beforeTimestamp,
@@ -30,7 +30,7 @@ const WalletsServiceLive = Layer.effect(WalletsService, Effect.gen(function* ()
30
30
  after_blocknumber: params?.afterBlocknumber,
31
31
  from_address: params?.fromAddress,
32
32
  to_address: params?.toAddress
33
- })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(TokenActivity)), Effect.mapError(ensureServiceError("Failed to get token activity"))),
33
+ })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(TokenActivitySchema)), Effect.mapError(ensureServiceError("Failed to get token activity"))),
34
34
  getTransactions: (query) => {
35
35
  const optionalFields = Record.getSomes(Record.map({
36
36
  from_address: query.fromAddress,
@@ -45,7 +45,7 @@ const WalletsServiceLive = Layer.effect(WalletsService, Effect.gen(function* ()
45
45
  blockchain: query.blockchain,
46
46
  page: query.page ?? 1,
47
47
  ...optionalFields
48
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(TransactionActivity)), Effect.mapError(ensureServiceError("Failed to get wallet transactions")));
48
+ }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(TransactionActivitySchema)), Effect.mapError(ensureServiceError("Failed to get wallet transactions")));
49
49
  }
50
50
  };
51
51
  }));
@@ -1,4 +1,4 @@
1
- import { HerdConfig } from "../config.js";
1
+ import { HerdConfigService } from "../config.js";
2
2
  import { ServiceError } from "../errors.js";
3
3
  import { Effect, Schema } from "effect";
4
4
  import { HttpBody, HttpClient, HttpClientResponse, UrlParams } from "effect/unstable/http";
@@ -9,7 +9,7 @@ declare const makeUrl: (baseUrl: string, path: string, queryParams?: object) =>
9
9
  declare const authorizedClient: Effect.Effect<{
10
10
  baseUrl: string;
11
11
  client: HttpClient.HttpClient.With<effect_unstable_http_HttpClientError0.HttpClientError, never>;
12
- }, never, HerdConfig | HttpClient.HttpClient>;
12
+ }, never, HerdConfigService | HttpClient.HttpClient>;
13
13
  declare const handleJsonResponse: <S extends Schema.Top>(schema: S) => (response: HttpClientResponse.HttpClientResponse) => Effect.Effect<S["Type"], ServiceError, S["DecodingServices"]>;
14
14
  declare const checkStatus: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect<HttpClientResponse.HttpClientResponse, ServiceError>;
15
15
  declare const jsonBody: (body: unknown) => HttpBody.HttpBody;
@@ -1,4 +1,4 @@
1
- import { HerdConfig } from "../config.js";
1
+ import { HerdConfigService } from "../config.js";
2
2
  import { ServiceError } from "../errors.js";
3
3
  import { Effect, Function, Result, pipe } from "effect";
4
4
  import { HttpBody, HttpClient, HttpClientRequest, HttpClientResponse, UrlParams } from "effect/unstable/http";
@@ -13,7 +13,7 @@ const makeUrl = (baseUrl, path, queryParams) => {
13
13
  return url.toString();
14
14
  };
15
15
  const authorizedClient = Effect.gen(function* () {
16
- const config = yield* HerdConfig;
16
+ const config = yield* HerdConfigService;
17
17
  const client = yield* HttpClient.HttpClient;
18
18
  const { baseUrl, authHeaders } = Result.match(config, {
19
19
  onFailure: ({ baseUrl: innerBaseUrl, oauthAccessToken }) => ({