Skip to content

Commit

Permalink
chore: bump versions; rm rocket references
Browse files Browse the repository at this point in the history
  • Loading branch information
8e8b2c committed Jul 30, 2024
1 parent 5c8f71d commit 3d757a0
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 48 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ jobs:
path: happ_workdir
- name: Move DNA
run: mv happ_workdir/holoom.dna ./holoom.dna
- name: Move server binary
run: mv rocket-artifact/holoom_rocket_server ./holoom_rocket_server-bookworm

- name: Download types dist
uses: actions/download-artifact@v4
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ dist
/packages/client/docs

docker/misc_hc/happ_workdir
docker/rocket/holoom_rocket_server

.DS_Store
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ A Holoom hApp network provides a space in which users can:

An npm library that provides helpers for interacting with a Holoom hApp agent, whether that be via the holo network, or with a conductor directly.

### Holoom Rocket Server
### `@holoom/authority`

Provides a REST API wrapper for a Holoom conductor instance (usually the authority agent). This is useful for building services around a Holoom network that are intended to be accessed without requiring ownership of an agent within the network.
Provides several micro-service-like nodeJS applications that can be attached to an authority agent enabling:

- REST queries of the user registry
- Fulfillment of username attestation requests
- Fulfillment of External ID attestation requests

## The Authority Agent

Expand All @@ -36,19 +40,12 @@ npm run test:dna

### `packages/e2e`

This provides coverage for using the hApp in conjunction with the `@holoom/client` and `holoom_rocket_server` components. To run these tests locally, docker should be running, and a one-time setup script needs invoking:

```
scripts/build_rocket_builder.sh
```

The above script enables caching of `holoom_rocket_server` build artefacts. (CI doesn't use this.) The full build and tests can then be invoked via:
This provides coverage for using the hApp in conjunction with the `@holoom/client` and `@holoom/authority` components. The full build and tests can then be invoked via:

```
npm run test:e2e
```

## API documents
## API documents

[Holoom API docs](https://holochain-open-dev.github.io/holoom)

10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/authority/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@holoom/authority",
"version": "0.1.0-dev.9",
"version": "0.1.0-dev.10",
"description": "Helpers for interacting with a holoom network authority agent",
"type": "module",
"license": "MIT",
Expand Down Expand Up @@ -50,7 +50,7 @@
"//": "TODO: These should probably be peer deps",
"dependencies": {
"@holochain/client": "^0.18.0-dev",
"@holoom/types": "0.1.0-dev.9",
"@holoom/types": "0.1.0-dev.10",
"@msgpack/msgpack": "^2.7.2",
"bs58": "^4.0.1",
"dotenv": "^16.4.5",
Expand Down
4 changes: 2 additions & 2 deletions packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@holoom/client",
"version": "0.1.0-dev.9",
"version": "0.1.0-dev.10",
"description": "Helpers for interacting with a holoom network agent",
"type": "module",
"license": "MIT",
Expand Down Expand Up @@ -55,7 +55,7 @@
"@solana/web3.js": "^1.87.6"
},
"dependencies": {
"@holoom/types": "0.1.0-dev.9",
"@holoom/types": "0.1.0-dev.10",
"@msgpack/msgpack": "^2.7.2",
"bs58": "^4.0.1",
"uuid": "^9.0.1",
Expand Down
14 changes: 5 additions & 9 deletions packages/client/src/external-id-attestation-requestor-client.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import type { AppWebsocket, AppSignal } from "@holochain/client";
import type { AppWebsocket, AppSignal, Record } from "@holochain/client";
import { v4 as uuidV4 } from "uuid";
import {
ExternalIdAttestation,
LocalHoloomSignal,
SendExternalIdAttestationRequestPayload,
} from "@holoom/types";
import { decodeAppEntry } from "./utils";
import { PickByType } from "./types";

type ExternalIdAttested = PickByType<LocalHoloomSignal, "ExternalIdAttested">;
type ExternalIdRejected = PickByType<LocalHoloomSignal, "ExternalIdRejected">;

class RequestResolver {
resolve!: (attestation: ExternalIdAttestation) => void;
resolve!: (record: Record) => void;
reject!: (reason: string) => void;
prom = new Promise<ExternalIdAttestation>((resolve, reject) => {
prom = new Promise<Record>((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
});
Expand Down Expand Up @@ -55,7 +53,7 @@ export class ExternalIdAttestationRequestorClient {
async requestExternalIdAttestation(
codeVerifier: string,
code: string
): Promise<ExternalIdAttestation> {
): Promise<Record> {
const requestId = uuidV4();
const resolver = new RequestResolver();
this.resolvers[requestId] = resolver;
Expand Down Expand Up @@ -93,14 +91,12 @@ export class ExternalIdAttestationRequestorClient {

private handleExternalIdAttested(signal: ExternalIdAttested) {
try {
const attestation = decodeAppEntry<ExternalIdAttestation>(signal.record);

const resolver = this.resolvers[signal.request_id];
if (!resolver) {
console.error(`Resolver for ${signal.request_id} not found`);
return;
}
resolver.resolve(attestation);
resolver.resolve(signal.record);
} catch (err) {
console.error(
"ExternalIdAttestationRequestorClient failed to decode ExternalIdAttestation"
Expand Down
1 change: 1 addition & 0 deletions packages/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export { HoloomClient } from "./holoom-client";
export { ExternalIdAttestationRequestorClient } from "./external-id-attestation-requestor-client";
export { EvmBytesSignatureRequestorClient } from "./evm-bytes-signature-requestor-client";
export { FaceitAuthFlowClient } from "./faceit-auth-flow-client";
export * from "./utils";
export * from "@holoom/types";
6 changes: 4 additions & 2 deletions packages/e2e/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
FaceitAuthFlowClient,
ExternalIdAttestationRequestorClient,
EvmBytesSignatureRequestorClient,
decodeAppEntry,
} from "@holoom/client";
import WebSdkApi, { ChaperoneState } from "@holo-host/web-sdk";

Expand Down Expand Up @@ -54,8 +55,9 @@ async function createClients() {
);
if (window.location.pathname.includes("/auth/callback")) {
const { code, codeVerifier } = faceitAuthFlow.getCodes();
global.externalIdRequestProm =
externalIdRequestor.requestExternalIdAttestation(codeVerifier!, code!);
global.externalIdRequestProm = externalIdRequestor
.requestExternalIdAttestation(codeVerifier!, code!)
.then(decodeAppEntry);
} else {
}
return {
Expand Down
8 changes: 4 additions & 4 deletions packages/e2e/tests/evm-wallet-binding.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { queryFetch } = require("./utils/query");
describe("EVM Wallet Binding", () => {
let testContainers;
beforeEach(async () => {
testContainers = await startTestContainers({ rocket: true });
testContainers = await startTestContainers({ query: true });
}, 60_000);
afterEach(async () => {
await Promise.all([testContainers?.stop(), jestPuppeteer.resetPage()]);
Expand All @@ -32,7 +32,7 @@ describe("EVM Wallet Binding", () => {
evm_addresses: [],
solana_addresses: [],
});
debug("Checked rocket serves empty wallet list");
debug("Checked query serves empty wallet list");

// Setup EVM signer in memory
// First account of seed phrase: test test test test test test test test test test test junk
Expand Down Expand Up @@ -71,7 +71,7 @@ describe("EVM Wallet Binding", () => {
}
debug("Polled bound wallets until correctly gossiped");

// Poll rocket until bound wallet gossiped
// Poll query until bound wallet gossiped
while (true) {
const data = await queryFetch(
`username_registry/${agentPubKeyB64}/wallets`
Expand All @@ -86,6 +86,6 @@ describe("EVM Wallet Binding", () => {
}
await new Promise((r) => setTimeout(r, 500));
}
debug("Polled bound wallets on rocket until correctly gossiped");
debug("Polled bound wallets on query until correctly gossiped");
}, 120_000);
});
6 changes: 3 additions & 3 deletions packages/e2e/tests/metadata.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { queryFetch } = require("./utils/query");
describe("metadata", () => {
let testContainers;
beforeEach(async () => {
testContainers = await startTestContainers({ rocket: true });
testContainers = await startTestContainers({ query: true });
}, 60_000);
afterEach(async () => {
await Promise.all([testContainers?.stop(), jestPuppeteer.resetPage()]);
Expand All @@ -29,7 +29,7 @@ describe("metadata", () => {
success: true,
metadata: {},
});
debug("Checked rocket serves empty metadata");
debug("Checked query serves empty metadata");

await expect(
page.evaluate(() =>
Expand Down Expand Up @@ -83,6 +83,6 @@ describe("metadata", () => {
}
await new Promise((r) => setTimeout(r, 500));
}
debug("Polled rocket metadata until metadata matched expected");
debug("Polled query metadata until metadata matched expected");
}, 120_000);
});
6 changes: 3 additions & 3 deletions packages/e2e/tests/username.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { queryFetch } = require("./utils/query");
describe("username", () => {
let testContainers;
beforeEach(async () => {
testContainers = await startTestContainers({ rocket: true });
testContainers = await startTestContainers({ query: true });
}, 60_000);
afterEach(async () => {
await Promise.all([testContainers?.stop(), jestPuppeteer.resetPage()]);
Expand All @@ -26,7 +26,7 @@ describe("username", () => {
success: true,
items: [],
});
debug("Checked rocket serves empty user list");
debug("Checked query serves empty user list");

// First register succeeds
await expect(
Expand All @@ -53,6 +53,6 @@ describe("username", () => {
await expect(queryFetch("username_registry")).resolves.toSatisfy(
(data) => data.items.length === 1 && data.items[0].username === "test1234"
);
debug("Checked rocket serves single user");
debug("Checked query serves single user");
}, 120_000);
});
6 changes: 3 additions & 3 deletions packages/e2e/tests/utils/testcontainers.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function startHoloContainer(network, localServicesIp) {
.start();
}

function startRocketContainer(network, authorityIp) {
function startQueryContainer(network, authorityIp) {
return new GenericContainer("holoom/query")
.withExposedPorts({ host: 8000, container: 8000 })
.withNetwork(network)
Expand Down Expand Up @@ -156,10 +156,10 @@ module.exports.startTestContainers = async (opts = {}) => {

const containerProms = [localServicesProm, authorityProm, holoProm];

if (opts.rocket) {
if (opts.query) {
containerProms.push(
authorityIpProm.then((authorityIp) =>
startRocketContainer(network, authorityIp)
startQueryContainer(network, authorityIp)
)
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@holoom/types",
"version": "0.1.0-dev.9",
"version": "0.1.0-dev.10",
"description": "Types generated from the holoom_types rust lib",
"type": "module",
"license": "MIT",
Expand Down

0 comments on commit 3d757a0

Please sign in to comment.