2 Commits

7 changed files with 22 additions and 33 deletions

View File

@@ -9,7 +9,7 @@ mkdir xo-terminal && cd xo-terminal
# ----- Start Engine Setup ----- # ----- Start Engine Setup -----
# Clone the Engine Repo (Note, this uses harvey's fork of the engine repo to access the cli-test branch) # Clone the Engine Repo (Note, this uses harvey's fork of the engine repo to access the cli-test branch)
git clone https://gitlab.com/Harvmaster/engine.git git clone git@gitlab.com:Harvmaster/engine.git
# Move into teh engine directory # Move into teh engine directory
cd engine cd engine
@@ -29,7 +29,7 @@ cd ..
# ----- Start State Setup ----- # ----- Start State Setup -----
# Clone the State Repo # Clone the State Repo
git clone https://gitlab.com/Harvmaster/state.git git clone git@gitlab.com:Harvmaster/state.git
# Move into the state directory # Move into the state directory
cd state cd state
@@ -46,26 +46,9 @@ npm run build
# Move back to the top level directory # Move back to the top level directory
cd .. cd ..
# ----- Start Template Setup ----
# Clone the Template repo
git clone https://gitlab.com/Harvmaster/templates.git
# Move into themplates directory
cd templates
# Install deps
npm ci
#build the templates
npm run build
# ----- End Templates Setup ----
# Move back to the top level directory
cd ..
# ----- Start CLI Setup ----- # ----- Start CLI Setup -----
# Clone the CLI Repo # Clone the CLI Repo
git clone https://git.harvmaster.com/Harvmaster/xo-cli.git git clone git@git.harvmaster.com:Harvmaster/xo-cli.git
# Move into the cli directory # Move into the cli directory
cd xo-cli cd xo-cli

View File

@@ -57,7 +57,7 @@ npx tsx src/index.ts # TUI
xo-cli mnemonic create xo-cli mnemonic create
# Import an existing mnemonic seed phrase # Import an existing mnemonic seed phrase
xo-cli mnemonic import oven crop same above under tower promote decrease vocal pretty require slow xo-cli mnemonic import page pencil stock planet limb cluster assault speak off joke private pioneer
# List mnemonic basenames (use with -m) # List mnemonic basenames (use with -m)
xo-cli mnemonic list xo-cli mnemonic list

View File

@@ -7,9 +7,9 @@ import { z } from "zod";
/** /**
* Converts the CLI args to a key-value object and return the options object along with the other arguments still in the array.\ * Converts the CLI args to a key-value object and return the options object along with the other arguments still in the array.\
* eg: `xo-cli mnemonic create oven crop same above under tower promote decrease vocal pretty require slow -v -o mnemonic.txt` will return: * eg: `xo-cli mnemonic create page pencil stock planet limb cluster assault speak off joke private pioneer -v -o mnemonic.txt` will return:
* { * {
* args: ["mnemonic", "create", "oven", "crop", "same", "above", "under", "tower", "promote", "decrease", "vocal", "pretty", "require", "slow"], * args: ["mnemonic", "create", "page", "pencil", "stock", "planet", "limb", "cluster", "assault", "speak", "off", "joke", "private", "pioneer"],
* options: { * options: {
* output: "mnemonic.txt", * output: "mnemonic.txt",
* verbose: "true", * verbose: "true",

View File

@@ -510,7 +510,7 @@ export class Invitation extends EventEmitter<InvitationEventMap> {
const templates = await this.engine.listImportedTemplates(); const templates = await this.engine.listImportedTemplates();
// For each template, we need to create a 2d array of all the outputs // For each template, we need to create a 2d array of all the outputs
const outputs = templates.map(template => { const outputs = templates.flatMap(template => {
return Object.keys(template.outputs).map(output => { return Object.keys(template.outputs).map(output => {
const templateIdentifier = generateTemplateIdentifier(template); const templateIdentifier = generateTemplateIdentifier(template);
@@ -522,7 +522,7 @@ export class Invitation extends EventEmitter<InvitationEventMap> {
}); });
// then, for each output, we need to get the spendable resources // then, for each output, we need to get the spendable resources
const spendableResources = await Promise.all(outputs.flat().map(output => { const spendableResources = await Promise.all(outputs.map(output => {
return this.engine.getSpendableResources(this.data, { return this.engine.getSpendableResources(this.data, {
templateIdentifier: output.templateIdentifier, templateIdentifier: output.templateIdentifier,
outputIdentifier: output.outputIdentifier, outputIdentifier: output.outputIdentifier,

View File

@@ -7,7 +7,7 @@
*/ */
import type { Invitation } from "../services/invitation.js"; import type { Invitation } from "../services/invitation.js";
import type { XOTemplate } from "@xo-cash/types"; import type { XOInvitationCommit, XOTemplate } from "@xo-cash/types";
/** /**
* Color names for invitation states. * Color names for invitation states.
@@ -249,9 +249,9 @@ export function formatInvitationId(id: string, maxLength: number = 16): string {
* @param invitation - The invitation to check * @param invitation - The invitation to check
* @returns Array of unique entity identifiers * @returns Array of unique entity identifiers
*/ */
export function getInvitationParticipants(invitation: Invitation): string[] { export function getInvitationParticipants(commits: Array<XOInvitationCommit>): string[] {
const participants = new Set<string>(); const participants = new Set<string>();
for (const commit of invitation.data.commits || []) { for (const commit of commits) {
if (commit.entityIdentifier) { if (commit.entityIdentifier) {
participants.add(commit.entityIdentifier); participants.add(commit.entityIdentifier);
} }
@@ -267,9 +267,14 @@ export function getInvitationParticipants(invitation: Invitation): string[] {
* @returns True if the user has made at least one commit * @returns True if the user has made at least one commit
*/ */
export function isUserParticipant( export function isUserParticipant(
invitation: Invitation, invitation: Invitation | Array<XOInvitationCommit>,
userEntityId: string | null, userEntityId: string | null,
): boolean { ): boolean {
if (!userEntityId) return false; if (!userEntityId) return false;
return getInvitationParticipants(invitation).includes(userEntityId);
if (Array.isArray(invitation)) {
return invitation.some(commit => commit.entityIdentifier === userEntityId);
}
return getInvitationParticipants(invitation.data.commits).includes(userEntityId);
} }

View File

@@ -19,7 +19,8 @@ import {
import { BCHMnemonicURL } from "../../src/utils/bch-mnemonic-url"; import { BCHMnemonicURL } from "../../src/utils/bch-mnemonic-url";
const TEST_SEED = const TEST_SEED =
"oven crop same above under tower promote decrease vocal pretty require slow"; "page pencil stock planet limb cluster assault speak off joke private pioneer";
describe("mnemonic utilities", () => { describe("mnemonic utilities", () => {
let tempDir: string; let tempDir: string;
@@ -53,7 +54,7 @@ describe("mnemonic utilities", () => {
test("creates a mnemonic file with auto-generated name", () => { test("creates a mnemonic file with auto-generated name", () => {
const filename = createMnemonicFile(tempDir, TEST_SEED); const filename = createMnemonicFile(tempDir, TEST_SEED);
expect(filename).toMatch(/^mnemonic-oven$/); expect(filename).toMatch(/^mnemonic-page$/);
expect(existsSync(path.join(tempDir, filename))).toBe(true); expect(existsSync(path.join(tempDir, filename))).toBe(true);
}); });

View File

@@ -18,7 +18,7 @@ import { MockRatesService } from "./rates-service";
import { RatesService } from "../../../src/services/rates"; import { RatesService } from "../../../src/services/rates";
export const DEFAULT_SEED = export const DEFAULT_SEED =
"oven crop same above under tower promote decrease vocal pretty require slow"; "page pencil stock planet limb cluster assault speak off joke private pioneer";
/** /**
* Options for creating a fake resource (UTXO) in tests. * Options for creating a fake resource (UTXO) in tests.