@herd-labs/sdk 0.3.1 → 0.5.0

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 (99) hide show
  1. package/dist/index.d.ts +17 -17
  2. package/dist/index.js +17 -17
  3. package/dist/src/config.d.ts +11 -11
  4. package/dist/src/config.js +9 -12
  5. package/dist/src/errors.d.ts +35 -44
  6. package/dist/src/errors.js +19 -16
  7. package/dist/src/live/ActionsServiceLive.d.ts +3 -3
  8. package/dist/src/live/ActionsServiceLive.js +14 -14
  9. package/dist/src/live/AdaptersServiceLive.d.ts +3 -3
  10. package/dist/src/live/AdaptersServiceLive.js +8 -8
  11. package/dist/src/live/AgentSafesServiceLive.d.ts +3 -3
  12. package/dist/src/live/AgentSafesServiceLive.js +5 -5
  13. package/dist/src/live/AgentWalletsServiceLive.d.ts +3 -3
  14. package/dist/src/live/AgentWalletsServiceLive.js +4 -4
  15. package/dist/src/live/AgentWorkflowsServiceLive.d.ts +3 -3
  16. package/dist/src/live/AgentWorkflowsServiceLive.js +14 -14
  17. package/dist/src/live/AuthServiceLive.d.ts +3 -3
  18. package/dist/src/live/AuthServiceLive.js +7 -7
  19. package/dist/src/live/BookmarksServiceLive.d.ts +3 -3
  20. package/dist/src/live/BookmarksServiceLive.js +20 -20
  21. package/dist/src/live/CodeBlocksServiceLive.d.ts +3 -3
  22. package/dist/src/live/CodeBlocksServiceLive.js +11 -11
  23. package/dist/src/live/CollectionsServiceLive.d.ts +3 -3
  24. package/dist/src/live/CollectionsServiceLive.js +6 -6
  25. package/dist/src/live/ContractsServiceLive.d.ts +3 -3
  26. package/dist/src/live/ContractsServiceLive.js +10 -10
  27. package/dist/src/live/DocsServiceLive.d.ts +3 -3
  28. package/dist/src/live/DocsServiceLive.js +4 -4
  29. package/dist/src/live/GroupsServiceLive.d.ts +3 -3
  30. package/dist/src/live/GroupsServiceLive.js +9 -9
  31. package/dist/src/live/HalServiceLive.d.ts +3 -3
  32. package/dist/src/live/HalServiceLive.js +12 -12
  33. package/dist/src/live/TransactionsServiceLive.d.ts +3 -3
  34. package/dist/src/live/TransactionsServiceLive.js +18 -18
  35. package/dist/src/live/WalletsServiceLive.d.ts +3 -3
  36. package/dist/src/live/WalletsServiceLive.js +18 -18
  37. package/dist/src/live/http.d.ts +6 -6
  38. package/dist/src/live/http.js +15 -15
  39. package/dist/src/schemas/actions.d.ts +179 -339
  40. package/dist/src/schemas/actions.js +80 -76
  41. package/dist/src/schemas/adapters.d.ts +7 -17
  42. package/dist/src/schemas/adapters.js +5 -5
  43. package/dist/src/schemas/agent-wallets.d.ts +98 -222
  44. package/dist/src/schemas/agent-wallets.js +52 -52
  45. package/dist/src/schemas/agent-workflows.d.ts +104 -104
  46. package/dist/src/schemas/agent-workflows.js +53 -49
  47. package/dist/src/schemas/auth.d.ts +35 -64
  48. package/dist/src/schemas/auth.js +16 -16
  49. package/dist/src/schemas/bookmarks.d.ts +98 -216
  50. package/dist/src/schemas/bookmarks.js +55 -51
  51. package/dist/src/schemas/codeblocks.d.ts +149 -308
  52. package/dist/src/schemas/codeblocks.js +72 -67
  53. package/dist/src/schemas/collections.d.ts +120 -232
  54. package/dist/src/schemas/collections.js +48 -44
  55. package/dist/src/schemas/common.d.ts +13 -29
  56. package/dist/src/schemas/common.js +8 -8
  57. package/dist/src/schemas/contracts.d.ts +256 -447
  58. package/dist/src/schemas/contracts.js +92 -103
  59. package/dist/src/schemas/docs.d.ts +12 -29
  60. package/dist/src/schemas/docs.js +9 -9
  61. package/dist/src/schemas/groups.d.ts +74 -74
  62. package/dist/src/schemas/groups.js +32 -32
  63. package/dist/src/schemas/hal.d.ts +109 -217
  64. package/dist/src/schemas/hal.js +44 -42
  65. package/dist/src/schemas/transactions.d.ts +648 -926
  66. package/dist/src/schemas/transactions.js +158 -162
  67. package/dist/src/schemas/wallets.d.ts +577 -731
  68. package/dist/src/schemas/wallets.js +206 -145
  69. package/dist/src/services/ActionsService.d.ts +3 -3
  70. package/dist/src/services/ActionsService.js +2 -2
  71. package/dist/src/services/AdaptersService.d.ts +1 -1
  72. package/dist/src/services/AdaptersService.js +2 -2
  73. package/dist/src/services/AgentSafesService.d.ts +5 -5
  74. package/dist/src/services/AgentSafesService.js +2 -2
  75. package/dist/src/services/AgentWalletsService.d.ts +3 -3
  76. package/dist/src/services/AgentWalletsService.js +2 -2
  77. package/dist/src/services/AgentWorkflowsService.d.ts +11 -11
  78. package/dist/src/services/AgentWorkflowsService.js +6 -2
  79. package/dist/src/services/AuthService.d.ts +5 -5
  80. package/dist/src/services/AuthService.js +2 -2
  81. package/dist/src/services/BookmarksService.d.ts +3 -3
  82. package/dist/src/services/BookmarksService.js +2 -2
  83. package/dist/src/services/CodeBlocksService.d.ts +1 -1
  84. package/dist/src/services/CodeBlocksService.js +2 -2
  85. package/dist/src/services/CollectionsService.d.ts +1 -1
  86. package/dist/src/services/CollectionsService.js +2 -2
  87. package/dist/src/services/ContractsService.d.ts +6 -6
  88. package/dist/src/services/ContractsService.js +2 -2
  89. package/dist/src/services/DocsService.d.ts +2 -2
  90. package/dist/src/services/DocsService.js +2 -2
  91. package/dist/src/services/GroupsService.d.ts +13 -13
  92. package/dist/src/services/GroupsService.js +4 -2
  93. package/dist/src/services/HalService.d.ts +1 -1
  94. package/dist/src/services/HalService.js +2 -2
  95. package/dist/src/services/TransactionsService.d.ts +5 -5
  96. package/dist/src/services/TransactionsService.js +2 -2
  97. package/dist/src/services/WalletsService.d.ts +5 -5
  98. package/dist/src/services/WalletsService.js +2 -2
  99. package/package.json +13 -18
@@ -1,16 +1,16 @@
1
1
  import { ensureServiceError } from "../errors.js";
2
- import { AgentWalletSafesList, AgentWalletsList } from "../schemas/agent-wallets.js";
2
+ import { AgentWalletSafesListSchema, AgentWalletsListSchema } from "../schemas/agent-wallets.js";
3
3
  import { AgentWalletsService } from "../services/AgentWalletsService.js";
4
4
  import { authorizedClient, checkStatus, makeUrl } from "./http.js";
5
5
  import { Effect, Layer, pipe } from "effect";
6
- import { HttpClientResponse } from "@effect/platform";
6
+ import { HttpClientResponse } from "effect/unstable/http";
7
7
 
8
8
  //#region src/live/AgentWalletsServiceLive.ts
9
9
  const AgentWalletsServiceLive = Layer.effect(AgentWalletsService, Effect.gen(function* () {
10
10
  const { baseUrl, client } = yield* authorizedClient;
11
11
  return {
12
- listAgentWallets: (params) => pipe(client.get(makeUrl(baseUrl, "/v1/agent-wallets", { groupId: params?.groupId })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(AgentWalletsList)), Effect.mapError(ensureServiceError("Failed to list agent wallets"))),
13
- listAgentWalletSafes: (agentWalletAddress) => pipe(client.get(makeUrl(baseUrl, `/v1/agent-wallets/${agentWalletAddress}/safes`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(AgentWalletSafesList)), Effect.mapError(ensureServiceError("Failed to list agent wallet Safes")))
12
+ listAgentWalletSafes: (agentWalletAddress) => pipe(client.get(makeUrl(baseUrl, `/v1/agent-wallets/${agentWalletAddress}/safes`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(AgentWalletSafesListSchema)), Effect.mapError(ensureServiceError("Failed to list agent wallet Safes"))),
13
+ listAgentWallets: (params) => pipe(client.get(makeUrl(baseUrl, "/v1/agent-wallets", { groupId: params?.groupId })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(AgentWalletsListSchema)), Effect.mapError(ensureServiceError("Failed to list agent wallets")))
14
14
  };
15
15
  }));
16
16
 
@@ -1,9 +1,9 @@
1
- import { HerdConfig } from "../config.js";
1
+ import { HerdConfigService } from "../config.js";
2
2
  import { AgentWorkflowsService } from "../services/AgentWorkflowsService.js";
3
3
  import { Layer } from "effect";
4
- import * as _effect_platform_HttpClient12 from "@effect/platform/HttpClient";
4
+ import * as effect_unstable_http_HttpClient8 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/AgentWorkflowsServiceLive.d.ts
7
- declare const AgentWorkflowsServiceLive: Layer.Layer<AgentWorkflowsService, never, HerdConfig | _effect_platform_HttpClient12.HttpClient>;
7
+ declare const AgentWorkflowsServiceLive: Layer.Layer<AgentWorkflowsService, never, HerdConfigService | effect_unstable_http_HttpClient8.HttpClient>;
8
8
  //#endregion
9
9
  export { AgentWorkflowsServiceLive };
@@ -1,35 +1,35 @@
1
1
  import { ServiceError, ensureServiceError } from "../errors.js";
2
- import { AgentWorkflowWithRuns, CreateAgentWorkflowResponse, CreateAgentWorkflowRunResponse, ExecuteSafeTxResponse, ListAgentWorkflowsResponse, PushAgentWorkflowResponse, SubmitAgentWorkflowDecisionResponse } from "../schemas/agent-workflows.js";
2
+ import { AgentWorkflowWithRunsSchema, CreateAgentWorkflowResponseSchema, CreateAgentWorkflowRunResponseSchema, ExecuteSafeTxResponseSchema, ListAgentWorkflowsResponseSchema, PushAgentWorkflowResponseSchema, SubmitAgentWorkflowDecisionResponseSchema } from "../schemas/agent-workflows.js";
3
3
  import { AgentWorkflowNotFoundError, AgentWorkflowRunNotFoundError, AgentWorkflowsService } from "../services/AgentWorkflowsService.js";
4
4
  import { authorizedClient, checkStatus, jsonBody, makeUrl } from "./http.js";
5
5
  import { Effect, Layer, pipe } from "effect";
6
- import { HttpClientResponse } from "@effect/platform";
6
+ import { HttpClientResponse } from "effect/unstable/http";
7
7
 
8
8
  //#region src/live/AgentWorkflowsServiceLive.ts
9
- const mapWorkflowNotFound = (workflowId) => Effect.catchAll((error) => {
9
+ const mapWorkflowNotFound = (workflowId) => Effect.catch((error) => {
10
10
  if (error instanceof ServiceError && error.metadata["status"] === 404) return Effect.fail(new AgentWorkflowNotFoundError(workflowId));
11
11
  return Effect.fail(error);
12
12
  });
13
- const mapRunNotFound = (runId) => Effect.catchAll((error) => {
13
+ const mapRunNotFound = (runId) => Effect.catch((error) => {
14
14
  if (error instanceof ServiceError && error.metadata["status"] === 404) return Effect.fail(new AgentWorkflowRunNotFoundError(runId));
15
15
  return Effect.fail(error);
16
16
  });
17
17
  const AgentWorkflowsServiceLive = Layer.effect(AgentWorkflowsService, Effect.gen(function* () {
18
18
  const { baseUrl, client } = yield* authorizedClient;
19
19
  return {
20
- create: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/agent-workflows"), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreateAgentWorkflowResponse)), Effect.mapError(ensureServiceError("Failed to create agent workflow"))),
21
- list: (params) => pipe(client.get(makeUrl(baseUrl, "/v1/agent-workflows", {
22
- groupId: params.groupId,
23
- type: params.type
24
- })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ListAgentWorkflowsResponse)), Effect.mapError(ensureServiceError("Failed to list agent workflows"))),
25
- get: (agentWorkflowId) => pipe(client.get(makeUrl(baseUrl, `/v1/agent-workflows/${agentWorkflowId}`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(AgentWorkflowWithRuns)), Effect.mapError(ensureServiceError("Failed to get agent workflow")), mapWorkflowNotFound(agentWorkflowId)),
20
+ create: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/agent-workflows"), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreateAgentWorkflowResponseSchema)), Effect.mapError(ensureServiceError("Failed to create agent workflow"))),
26
21
  createRun: (params) => pipe(client.post(makeUrl(baseUrl, `/v1/agent-workflows/${params.agentWorkflowId}/runs`), { body: jsonBody({
27
22
  outputs: params.outputs,
28
23
  changelog: params.changelog
29
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreateAgentWorkflowRunResponse)), Effect.mapError(ensureServiceError("Failed to create agent workflow run")), mapWorkflowNotFound(params.agentWorkflowId)),
30
- submitDecision: (params) => pipe(client.post(makeUrl(baseUrl, `/v1/agent-workflows/runs/${params.agentWorkflowRunId}/decisions`), { body: jsonBody({ decision: params.decision }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(SubmitAgentWorkflowDecisionResponse)), Effect.mapError(ensureServiceError("Failed to submit agent workflow decision")), mapRunNotFound(params.agentWorkflowRunId)),
31
- push: (params) => pipe(client.post(makeUrl(baseUrl, `/v1/agent-workflows/runs/${params.agentWorkflowRunId}/push`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(PushAgentWorkflowResponse)), Effect.mapError(ensureServiceError("Failed to push agent workflow")), mapRunNotFound(params.agentWorkflowRunId)),
32
- executeSafeTx: (params) => pipe(client.post(makeUrl(baseUrl, `/v1/agent-workflows/runs/${params.agentWorkflowRunId}/push/execute`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ExecuteSafeTxResponse)), Effect.mapError(ensureServiceError("Failed to execute safe transaction")), mapRunNotFound(params.agentWorkflowRunId))
24
+ }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreateAgentWorkflowRunResponseSchema)), Effect.mapError(ensureServiceError("Failed to create agent workflow run")), mapWorkflowNotFound(params.agentWorkflowId)),
25
+ executeSafeTx: (params) => pipe(client.post(makeUrl(baseUrl, `/v1/agent-workflows/runs/${params.agentWorkflowRunId}/push/execute`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ExecuteSafeTxResponseSchema)), Effect.mapError(ensureServiceError("Failed to execute safe transaction")), mapRunNotFound(params.agentWorkflowRunId)),
26
+ get: (agentWorkflowId) => pipe(client.get(makeUrl(baseUrl, `/v1/agent-workflows/${agentWorkflowId}`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(AgentWorkflowWithRunsSchema)), Effect.mapError(ensureServiceError("Failed to get agent workflow")), mapWorkflowNotFound(agentWorkflowId)),
27
+ list: (params) => pipe(client.get(makeUrl(baseUrl, "/v1/agent-workflows", {
28
+ groupId: params.groupId,
29
+ type: params.type
30
+ })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ListAgentWorkflowsResponseSchema)), Effect.mapError(ensureServiceError("Failed to list agent workflows"))),
31
+ push: (params) => pipe(client.post(makeUrl(baseUrl, `/v1/agent-workflows/runs/${params.agentWorkflowRunId}/push`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(PushAgentWorkflowResponseSchema)), Effect.mapError(ensureServiceError("Failed to push agent workflow")), mapRunNotFound(params.agentWorkflowRunId)),
32
+ submitDecision: (params) => pipe(client.post(makeUrl(baseUrl, `/v1/agent-workflows/runs/${params.agentWorkflowRunId}/decisions`), { body: jsonBody({ decision: params.decision }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(SubmitAgentWorkflowDecisionResponseSchema)), Effect.mapError(ensureServiceError("Failed to submit agent workflow decision")), mapRunNotFound(params.agentWorkflowRunId))
33
33
  };
34
34
  }));
35
35
 
@@ -1,9 +1,9 @@
1
- import { HerdConfig } from "../config.js";
1
+ import { HerdConfigService } from "../config.js";
2
2
  import { AuthService } from "../services/AuthService.js";
3
3
  import { Layer } from "effect";
4
- import * as _effect_platform_HttpClient13 from "@effect/platform/HttpClient";
4
+ import * as effect_unstable_http_HttpClient7 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/AuthServiceLive.d.ts
7
- declare const AuthServiceLive: Layer.Layer<AuthService, never, HerdConfig | _effect_platform_HttpClient13.HttpClient>;
7
+ declare const AuthServiceLive: Layer.Layer<AuthService, never, HerdConfigService | effect_unstable_http_HttpClient7.HttpClient>;
8
8
  //#endregion
9
9
  export { AuthServiceLive };
@@ -1,24 +1,24 @@
1
1
  import { AuthError } from "../errors.js";
2
- import { ApiKeyListResponse, CreatedApiKey, TokenResponse, WhoamiResponse } from "../schemas/auth.js";
2
+ import { ApiKeyListResponseSchema, CreatedApiKeySchema, TokenResponseSchema, WhoamiResponseSchema } from "../schemas/auth.js";
3
3
  import { AuthService } from "../services/AuthService.js";
4
4
  import { authorizedClient, checkStatus, jsonBody, makeUrl, urlEncodedBody } from "./http.js";
5
5
  import { Effect, Layer, pipe } from "effect";
6
- import { HttpClientResponse } from "@effect/platform";
6
+ import { HttpClientResponse } from "effect/unstable/http";
7
7
 
8
8
  //#region src/live/AuthServiceLive.ts
9
9
  const AuthServiceLive = Layer.effect(AuthService, Effect.gen(function* () {
10
10
  const { baseUrl, client } = yield* authorizedClient;
11
11
  return {
12
- whoami: () => pipe(client.get(makeUrl(baseUrl, "/v1/users/me")), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(WhoamiResponse)), Effect.mapError((error) => new AuthError({ message: String(error) }))),
12
+ listApiKeys: pipe(client.get(makeUrl(baseUrl, "/v1/api-keys")), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ApiKeyListResponseSchema)), Effect.mapError((error) => new AuthError({ message: String(error) }))),
13
+ provisionApiKey: (name) => pipe(client.post(makeUrl(baseUrl, "/v1/api-keys"), { body: jsonBody({ name }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreatedApiKeySchema)), Effect.mapError((error) => new AuthError({ message: String(error) }))),
13
14
  refreshToken: (refreshToken, clientId) => pipe(client.post(makeUrl(baseUrl, "/api/auth/oauth2/token"), { body: urlEncodedBody({
14
15
  grant_type: "refresh_token",
15
16
  refresh_token: refreshToken,
16
17
  client_id: clientId,
17
18
  resource: baseUrl
18
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(TokenResponse)), Effect.mapError((error) => new AuthError({ message: String(error) }))),
19
- provisionApiKey: (name) => pipe(client.post(makeUrl(baseUrl, "/v1/api-keys"), { body: jsonBody({ name }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreatedApiKey)), Effect.mapError((error) => new AuthError({ message: String(error) }))),
20
- listApiKeys: () => pipe(client.get(makeUrl(baseUrl, "/v1/api-keys")), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ApiKeyListResponse)), Effect.mapError((error) => new AuthError({ message: String(error) }))),
21
- revokeApiKey: (keyId) => pipe(client.del(makeUrl(baseUrl, `/v1/api-keys/${keyId}`)), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError((error) => new AuthError({ message: String(error) })))
19
+ }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(TokenResponseSchema)), Effect.mapError((error) => new AuthError({ message: String(error) }))),
20
+ revokeApiKey: (keyId) => pipe(client.del(makeUrl(baseUrl, `/v1/api-keys/${keyId}`)), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError((error) => new AuthError({ message: String(error) }))),
21
+ whoami: pipe(client.get(makeUrl(baseUrl, "/v1/users/me")), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(WhoamiResponseSchema)), Effect.mapError((error) => new AuthError({ message: String(error) })))
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 { BookmarksService } from "../services/BookmarksService.js";
3
3
  import { Layer } from "effect";
4
- import * as _effect_platform_HttpClient2 from "@effect/platform/HttpClient";
4
+ import * as effect_unstable_http_HttpClient1 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/BookmarksServiceLive.d.ts
7
- declare const BookmarksServiceLive: Layer.Layer<BookmarksService, never, HerdConfig | _effect_platform_HttpClient2.HttpClient>;
7
+ declare const BookmarksServiceLive: Layer.Layer<BookmarksService, never, HerdConfigService | effect_unstable_http_HttpClient1.HttpClient>;
8
8
  //#endregion
9
9
  export { BookmarksServiceLive };
@@ -1,15 +1,14 @@
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";
6
- import { HttpClientResponse } from "@effect/platform";
6
+ import { HttpClientResponse } from "effect/unstable/http";
7
7
 
8
8
  //#region src/live/BookmarksServiceLive.ts
9
9
  const BookmarksServiceLive = Layer.effect(BookmarksService, Effect.gen(function* () {
10
10
  const { baseUrl, client } = yield* authorizedClient;
11
11
  return {
12
- 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"))),
13
12
  addContract: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/bookmarks"), { body: jsonBody({
14
13
  objectType: "contract",
15
14
  contractAddress: params.address,
@@ -18,8 +17,8 @@ const BookmarksServiceLive = Layer.effect(BookmarksService, Effect.gen(function*
18
17
  savedFunctions: [],
19
18
  savedEvents: []
20
19
  },
21
- ...params.label !== void 0 ? { userLabel: params.label } : {}
22
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponse)), Effect.mapError(ensureServiceError("Failed to add contract bookmark"))),
20
+ ...params.label === void 0 ? {} : { userLabel: params.label }
21
+ }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponseSchema)), Effect.mapError(ensureServiceError("Failed to add contract bookmark"))),
23
22
  addTransaction: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/bookmarks"), { body: jsonBody({
24
23
  objectType: "transaction",
25
24
  transactionHash: params.txHash,
@@ -28,29 +27,30 @@ const BookmarksServiceLive = Layer.effect(BookmarksService, Effect.gen(function*
28
27
  savedFunctions: [],
29
28
  savedEvents: []
30
29
  },
31
- ...params.label !== void 0 ? { userLabel: params.label } : {}
32
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponse)), Effect.mapError(ensureServiceError("Failed to add transaction bookmark"))),
30
+ ...params.label === void 0 ? {} : { userLabel: params.label }
31
+ }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponseSchema)), Effect.mapError(ensureServiceError("Failed to add transaction bookmark"))),
33
32
  addWallet: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/bookmarks"), { body: jsonBody({
34
33
  objectType: "wallet",
35
34
  walletAddress: params.address,
36
35
  details: {},
37
- ...params.label !== void 0 ? { userLabel: params.label } : {}
38
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponse)), Effect.mapError(ensureServiceError("Failed to add wallet bookmark"))),
39
- updateLabel: (params) => pipe(client.patch(makeUrl(baseUrl, "/v1/bookmarks/label"), { body: jsonBody({
36
+ ...params.label === void 0 ? {} : { userLabel: params.label }
37
+ }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponseSchema)), Effect.mapError(ensureServiceError("Failed to add wallet bookmark"))),
38
+ delete: (params) => pipe(client.del(makeUrl(baseUrl, "/v1/bookmarks"), { body: jsonBody({
40
39
  objectType: params.objectType,
41
- ...params.address !== void 0 ? { contractAddress: params.address } : {},
40
+ ...params.address === void 0 ? {} : { contractAddress: params.address },
42
41
  ...params.address !== void 0 && params.objectType === "wallet" ? { walletAddress: params.address } : {},
43
- ...params.txHash !== void 0 ? { transactionHash: params.txHash } : {},
44
- ...params.blockchain !== void 0 ? { blockchain: params.blockchain } : {},
45
- userLabel: params.label
46
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponse)), Effect.mapError(ensureServiceError("Failed to update bookmark label"))),
47
- delete: (params) => pipe(client.del(makeUrl(baseUrl, "/v1/bookmarks"), { body: jsonBody({
42
+ ...params.txHash === void 0 ? {} : { transactionHash: params.txHash },
43
+ ...params.blockchain === void 0 ? {} : { blockchain: params.blockchain }
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(BookmarksListSchema)), Effect.mapError(ensureServiceError("Failed to list bookmarks"))),
46
+ updateLabel: (params) => pipe(client.patch(makeUrl(baseUrl, "/v1/bookmarks/label"), { body: jsonBody({
48
47
  objectType: params.objectType,
49
- ...params.address !== void 0 ? { contractAddress: params.address } : {},
48
+ ...params.address === void 0 ? {} : { contractAddress: params.address },
50
49
  ...params.address !== void 0 && params.objectType === "wallet" ? { walletAddress: params.address } : {},
51
- ...params.txHash !== void 0 ? { transactionHash: params.txHash } : {},
52
- ...params.blockchain !== void 0 ? { blockchain: params.blockchain } : {}
53
- }) }), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to delete bookmark")))
50
+ ...params.txHash === void 0 ? {} : { transactionHash: params.txHash },
51
+ ...params.blockchain === void 0 ? {} : { blockchain: params.blockchain },
52
+ userLabel: params.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_platform_HttpClient9 from "@effect/platform/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_platform_HttpClient9.HttpClient>;
7
+ declare const CodeBlocksServiceLive: Layer.Layer<CodeBlocksService, never, HerdConfigService | effect_unstable_http_HttpClient2.HttpClient>;
8
8
  //#endregion
9
9
  export { CodeBlocksServiceLive };
@@ -1,34 +1,34 @@
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";
6
- import { HttpClientResponse } from "@effect/platform";
6
+ import { HttpClientResponse } from "effect/unstable/http";
7
7
 
8
8
  //#region src/live/CodeBlocksServiceLive.ts
9
- const mapNotFound = (id) => Effect.catchAll((error) => {
9
+ const mapNotFound = (id) => Effect.catch((error) => {
10
10
  if (error instanceof ServiceError && error.metadata["status"] === 404) return Effect.fail(new CodeBlockNotFoundError({ id }));
11
11
  return Effect.fail(error);
12
12
  });
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(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
+ 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(CodeBlockExecuteResponseSchema)), Effect.mapError(ensureServiceError("Failed to execute code block")), mapNotFound(definitionId)),
16
20
  get: (id) => pipe(client.post(makeUrl(baseUrl, "/v1/actions/code/definitions/query"), { body: jsonBody({
17
21
  scope: "user",
18
22
  limit: 1,
19
23
  filters: { id }
20
- }) }), 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({
21
25
  onNone: () => Effect.fail(new CodeBlockNotFoundError({ id })),
22
26
  onSome: Effect.succeed
23
27
  })))),
24
- 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"))),
25
- 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"))),
26
- 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)),
27
- 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)),
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"))),
28
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)),
29
- 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)),
30
- 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)),
31
- 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))
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
  };
33
33
  }));
34
34
 
@@ -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_platform_HttpClient4 from "@effect/platform/HttpClient";
4
+ import * as effect_unstable_http_HttpClient0 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_platform_HttpClient4.HttpClient>;
7
+ declare const CollectionsServiceLive: Layer.Layer<CollectionsService, never, HerdConfigService | effect_unstable_http_HttpClient0.HttpClient>;
8
8
  //#endregion
9
9
  export { CollectionsServiceLive };
@@ -1,21 +1,21 @@
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";
6
- import { HttpClientResponse } from "@effect/platform";
6
+ import { HttpClientResponse } from "effect/unstable/http";
7
7
 
8
8
  //#region src/live/CollectionsServiceLive.ts
9
- const mapNotFound = (id) => Effect.catchAll((error) => {
9
+ const mapNotFound = (id) => Effect.catch((error) => {
10
10
  if (error instanceof ServiceError && error.metadata["status"] === 404) return Effect.fail(new CollectionNotFoundError({ id }));
11
11
  return Effect.fail(error);
12
12
  });
13
13
  const CollectionsServiceLive = Layer.effect(CollectionsService, Effect.gen(function* () {
14
14
  const { baseUrl, client } = yield* authorizedClient;
15
15
  return {
16
- 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)),
17
- 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"))),
18
- 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"))),
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_platform_HttpClient5 from "@effect/platform/HttpClient";
4
+ import * as effect_unstable_http_HttpClient13 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_platform_HttpClient5.HttpClient>;
7
+ declare const ContractsServiceLive: Layer.Layer<ContractsService, never, HerdConfigService | effect_unstable_http_HttpClient13.HttpClient>;
8
8
  //#endregion
9
9
  export { ContractsServiceLive };
@@ -1,29 +1,29 @@
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";
7
- import { HttpClientResponse } from "@effect/platform";
7
+ import { HttpClientResponse } from "effect/unstable/http";
8
8
 
9
9
  //#region src/live/ContractsServiceLive.ts
10
10
  const ContractsServiceLive = Layer.effect(ContractsService, Effect.gen(function* () {
11
11
  const { baseUrl, client } = yield* authorizedClient;
12
12
  return {
13
- getMetadata: (address, blockchain) => pipe(client.post(makeUrl(baseUrl, "/v1/contracts/metadata_enriched"), { body: jsonBody({
14
- contractAddress: address,
15
- blockchain
16
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ContractMetadata)), Effect.mapError(ensureServiceError("Failed to get contract metadata"))),
17
13
  diffVersions: (address, blockchain, params) => pipe(client.post(makeUrl(baseUrl, "/v1/contracts/diff_versions"), { body: jsonBody({
18
14
  contractAddress: address,
19
15
  blockchain,
20
16
  ...params
21
- }) }), 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"))),
22
18
  getContractCode: (blockchain, params) => pipe(client.post(makeUrl(baseUrl, "/v1/contracts/code/query"), { body: jsonBody({
23
19
  blockchain,
24
20
  ...params
25
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(GetContractCodeResponse)), Effect.mapError(ensureServiceError("Failed to get contract code"))),
26
- 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
+ getMetadata: (address, blockchain) => pipe(client.post(makeUrl(baseUrl, "/v1/contracts/metadata_enriched"), { body: jsonBody({
24
+ contractAddress: address,
25
+ blockchain
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_platform_HttpClient3 from "@effect/platform/HttpClient";
4
+ import * as effect_unstable_http_HttpClient10 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_platform_HttpClient3.HttpClient>;
7
+ declare const DocsServiceLive: Layer.Layer<DocsService, never, HerdConfigService | effect_unstable_http_HttpClient10.HttpClient>;
8
8
  //#endregion
9
9
  export { DocsServiceLive };
@@ -1,21 +1,21 @@
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";
6
- import { HttpClientResponse } from "@effect/platform";
6
+ import { HttpClientResponse } from "effect/unstable/http";
7
7
 
8
8
  //#region src/live/DocsServiceLive.ts
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
  }));
@@ -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_platform_HttpClient7 from "@effect/platform/HttpClient";
4
+ import * as effect_unstable_http_HttpClient5 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_platform_HttpClient7.HttpClient>;
7
+ declare const GroupsServiceLive: Layer.Layer<GroupsService, never, HerdConfigService | effect_unstable_http_HttpClient5.HttpClient>;
8
8
  //#endregion
9
9
  export { GroupsServiceLive };
@@ -1,24 +1,24 @@
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";
6
- import { HttpClientResponse } from "@effect/platform";
6
+ import { HttpClientResponse } from "effect/unstable/http";
7
7
 
8
8
  //#region src/live/GroupsServiceLive.ts
9
- const mapNotFound = (groupId) => Effect.catchAll((error) => {
9
+ const mapNotFound = (groupId) => Effect.catch((error) => {
10
10
  if (error instanceof ServiceError && error.metadata["status"] === 404) return Effect.fail(new GroupNotFoundError(groupId));
11
11
  return Effect.fail(error);
12
12
  });
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
- list: () => pipe(client.get(makeUrl(baseUrl, "/v1/groups")), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ListGroupsResponse)), Effect.mapError(ensureServiceError("Failed to list groups"))),
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
- 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)),
20
- 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)),
21
- 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))
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_platform_HttpClient8 from "@effect/platform/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_platform_HttpClient8.HttpClient>;
7
+ declare const HalServiceLive: Layer.Layer<HalService, never, HerdConfigService | effect_unstable_http_HttpClient11.HttpClient>;
8
8
  //#endregion
9
9
  export { HalServiceLive };
@@ -1,39 +1,39 @@
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";
6
- import { HttpClientResponse } from "@effect/platform";
6
+ import { HttpClientResponse } from "effect/unstable/http";
7
7
 
8
8
  //#region src/live/HalServiceLive.ts
9
- const mapSimulationError = Effect.catchAll((error) => {
9
+ const mapSimulationError = Effect.catch((error) => {
10
10
  if (error instanceof ServiceError && error.metadata["status"] === 400) return Effect.fail(new SimulationError({
11
- name: "SimulationError",
12
- message: String(error.metadata["body"])
11
+ message: String(error.metadata["body"]),
12
+ name: "SimulationError"
13
13
  }));
14
14
  return Effect.fail(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,
23
23
  inputValues: params.inputValues ?? {},
24
- walletAddress: params.walletAddress,
25
24
  simulationBalanceFunding: params.simulationBalanceFunding ?? [],
25
+ simulationBlockNumber: params.simulationBlockNumber,
26
26
  tevmForkId: params.tevmForkId,
27
- simulationBlockNumber: params.simulationBlockNumber
27
+ walletAddress: params.walletAddress
28
28
  }),
29
29
  evaluateExisting: (params) => callEvaluateExisting({
30
- actionId: params.actionId,
31
30
  actionExpressionId: params.actionExpressionId,
32
- walletAddress: params.walletAddress,
31
+ actionId: params.actionId,
33
32
  inputValues: params.inputValues ?? {},
34
33
  simulationBalanceFunding: params.simulationBalanceFunding ?? [],
34
+ simulationBlockNumber: params.simulationBlockNumber,
35
35
  tevmForkId: params.tevmForkId,
36
- simulationBlockNumber: params.simulationBlockNumber
36
+ walletAddress: params.walletAddress
37
37
  })
38
38
  };
39
39
  }));
@@ -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_platform_HttpClient6 from "@effect/platform/HttpClient";
4
+ import * as effect_unstable_http_HttpClient12 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_platform_HttpClient6.HttpClient>;
7
+ declare const TransactionsServiceLive: Layer.Layer<TransactionsService, never, HerdConfigService | effect_unstable_http_HttpClient12.HttpClient>;
8
8
  //#endregion
9
9
  export { TransactionsServiceLive };