@herd-labs/sdk 0.4.0 → 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 (79) hide show
  1. package/dist/index.d.ts +17 -17
  2. package/dist/index.js +17 -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 +3 -3
  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 +2 -2
  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 +3 -3
  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/GroupsServiceLive.d.ts +3 -3
  30. package/dist/src/live/GroupsServiceLive.js +7 -7
  31. package/dist/src/live/HalServiceLive.d.ts +3 -3
  32. package/dist/src/live/HalServiceLive.js +3 -3
  33. package/dist/src/live/TransactionsServiceLive.d.ts +3 -3
  34. package/dist/src/live/TransactionsServiceLive.js +4 -4
  35. package/dist/src/live/WalletsServiceLive.d.ts +3 -3
  36. package/dist/src/live/WalletsServiceLive.js +5 -5
  37. package/dist/src/live/http.d.ts +2 -2
  38. package/dist/src/live/http.js +2 -2
  39. package/dist/src/schemas/actions.d.ts +127 -59
  40. package/dist/src/schemas/actions.js +42 -42
  41. package/dist/src/schemas/adapters.d.ts +4 -4
  42. package/dist/src/schemas/adapters.js +3 -3
  43. package/dist/src/schemas/agent-wallets.d.ts +57 -37
  44. package/dist/src/schemas/agent-wallets.js +35 -35
  45. package/dist/src/schemas/agent-workflows.d.ts +35 -35
  46. package/dist/src/schemas/agent-workflows.js +19 -19
  47. package/dist/src/schemas/auth.d.ts +19 -19
  48. package/dist/src/schemas/auth.js +10 -10
  49. package/dist/src/schemas/bookmarks.d.ts +58 -36
  50. package/dist/src/schemas/bookmarks.js +34 -34
  51. package/dist/src/schemas/codeblocks.d.ts +89 -52
  52. package/dist/src/schemas/codeblocks.js +34 -34
  53. package/dist/src/schemas/collections.d.ts +76 -32
  54. package/dist/src/schemas/collections.js +23 -23
  55. package/dist/src/schemas/common.d.ts +8 -8
  56. package/dist/src/schemas/common.js +5 -5
  57. package/dist/src/schemas/contracts.d.ts +176 -61
  58. package/dist/src/schemas/contracts.js +47 -47
  59. package/dist/src/schemas/docs.d.ts +7 -7
  60. package/dist/src/schemas/docs.js +5 -5
  61. package/dist/src/schemas/groups.d.ts +27 -27
  62. package/dist/src/schemas/groups.js +16 -16
  63. package/dist/src/schemas/hal.d.ts +64 -18
  64. package/dist/src/schemas/hal.js +18 -18
  65. package/dist/src/schemas/transactions.d.ts +264 -56
  66. package/dist/src/schemas/transactions.js +50 -50
  67. package/dist/src/schemas/wallets.d.ts +434 -84
  68. package/dist/src/schemas/wallets.js +114 -69
  69. package/dist/src/services/ActionsService.d.ts +2 -2
  70. package/dist/src/services/AgentSafesService.d.ts +4 -4
  71. package/dist/src/services/AgentWalletsService.d.ts +2 -2
  72. package/dist/src/services/AgentWorkflowsService.d.ts +8 -8
  73. package/dist/src/services/AuthService.d.ts +3 -3
  74. package/dist/src/services/BookmarksService.d.ts +2 -2
  75. package/dist/src/services/ContractsService.d.ts +5 -5
  76. package/dist/src/services/GroupsService.d.ts +11 -11
  77. package/dist/src/services/TransactionsService.d.ts +4 -4
  78. package/dist/src/services/WalletsService.d.ts +4 -4
  79. package/package.json +2 -2
@@ -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_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_unstable_http_HttpClient9.HttpClient>;
7
+ declare const CollectionsServiceLive: Layer.Layer<CollectionsService, never, HerdConfigService | effect_unstable_http_HttpClient0.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_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_unstable_http_HttpClient7.HttpClient>;
7
+ declare const ContractsServiceLive: Layer.Layer<ContractsService, never, HerdConfigService | effect_unstable_http_HttpClient13.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_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_unstable_http_HttpClient11.HttpClient>;
7
+ declare const DocsServiceLive: Layer.Layer<DocsService, never, HerdConfigService | effect_unstable_http_HttpClient10.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
  }));
@@ -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_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_unstable_http_HttpClient12.HttpClient>;
7
+ declare const GroupsServiceLive: Layer.Layer<GroupsService, never, HerdConfigService | effect_unstable_http_HttpClient5.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_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_unstable_http_HttpClient4.HttpClient>;
7
+ declare const TransactionsServiceLive: Layer.Layer<TransactionsService, never, HerdConfigService | effect_unstable_http_HttpClient12.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_HttpClient9 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_HttpClient9.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 }) => ({