Compare commits
3 Commits
use-flatma
...
12b7bde74f
| Author | SHA1 | Date | |
|---|---|---|---|
| 12b7bde74f | |||
| 42d23fa35e | |||
| b6ee25d1dd |
23
readme.md
23
readme.md
@@ -9,7 +9,7 @@ mkdir xo-terminal && cd xo-terminal
|
||||
|
||||
# ----- Start Engine Setup -----
|
||||
# Clone the Engine Repo (Note, this uses harvey's fork of the engine repo to access the cli-test branch)
|
||||
git clone git@gitlab.com:Harvmaster/engine.git
|
||||
git clone https://gitlab.com/Harvmaster/engine.git
|
||||
|
||||
# Move into teh engine directory
|
||||
cd engine
|
||||
@@ -29,7 +29,7 @@ cd ..
|
||||
|
||||
# ----- Start State Setup -----
|
||||
# Clone the State Repo
|
||||
git clone git@gitlab.com:Harvmaster/state.git
|
||||
git clone https://gitlab.com/Harvmaster/state.git
|
||||
|
||||
# Move into the state directory
|
||||
cd state
|
||||
@@ -46,9 +46,26 @@ npm run build
|
||||
# Move back to the top level directory
|
||||
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 -----
|
||||
# Clone the CLI Repo
|
||||
git clone git@git.harvmaster.com:Harvmaster/xo-cli.git
|
||||
git clone https://git.harvmaster.com/Harvmaster/xo-cli.git
|
||||
|
||||
# Move into the cli directory
|
||||
cd xo-cli
|
||||
|
||||
@@ -510,7 +510,7 @@ export class Invitation extends EventEmitter<InvitationEventMap> {
|
||||
const templates = await this.engine.listImportedTemplates();
|
||||
|
||||
// For each template, we need to create a 2d array of all the outputs
|
||||
const outputs = templates.flatMap(template => {
|
||||
const outputs = templates.map(template => {
|
||||
return Object.keys(template.outputs).map(output => {
|
||||
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
|
||||
const spendableResources = await Promise.all(outputs.map(output => {
|
||||
const spendableResources = await Promise.all(outputs.flat().map(output => {
|
||||
return this.engine.getSpendableResources(this.data, {
|
||||
templateIdentifier: output.templateIdentifier,
|
||||
outputIdentifier: output.outputIdentifier,
|
||||
|
||||
@@ -19,7 +19,7 @@ import path from 'path';
|
||||
import { createMnemonicFile } from '../../cli/mnemonic.js';
|
||||
import { getMnemonicsDir } from '../../utils/paths.js';
|
||||
import { BCHMnemonicURL } from '../../utils/bch-mnemonic-url.js';
|
||||
import { encodeBip39Mnemonic, generateBip39Mnemonic } from '@bitauth/libauth';
|
||||
import { encodeBip39Mnemonic } from '@bitauth/libauth';
|
||||
|
||||
/**
|
||||
* Status message type.
|
||||
@@ -41,7 +41,7 @@ interface MnemonicFileEntry {
|
||||
* Focus sections the user can tab between.
|
||||
* When saved wallets exist the file list is shown first.
|
||||
*/
|
||||
type FocusSection = 'files' | 'input' | 'saveCheckbox' | 'generateRandomSeed' | 'button';
|
||||
type FocusSection = 'files' | 'input' | 'saveCheckbox' | 'button';
|
||||
|
||||
/**
|
||||
* Reads mnemonic-* files from ~/.config/xo-cli/mnemonics/ (same as xo-cli),
|
||||
@@ -117,8 +117,8 @@ export function SeedInputScreen(): React.ReactElement {
|
||||
* The ordered list of focusable sections (files section only when entries exist).
|
||||
*/
|
||||
const focusSections: FocusSection[] = mnemonicFiles.length > 0
|
||||
? ['files', 'input', 'generateRandomSeed', 'saveCheckbox', 'button']
|
||||
: ['input', 'generateRandomSeed', 'saveCheckbox', 'button'];
|
||||
? ['files', 'input', 'saveCheckbox', 'button']
|
||||
: ['input', 'saveCheckbox', 'button'];
|
||||
|
||||
/**
|
||||
* Shows a status message with the given type.
|
||||
@@ -202,7 +202,7 @@ export function SeedInputScreen(): React.ReactElement {
|
||||
}, [mnemonicFiles, doInitialize]);
|
||||
|
||||
// Keyboard navigation
|
||||
useBlockableInput((input, key) => {
|
||||
useBlockableInput((_input, key) => {
|
||||
if (isSubmitting) return;
|
||||
|
||||
// Tab / Shift-Tab to cycle focus sections
|
||||
@@ -219,7 +219,7 @@ export function SeedInputScreen(): React.ReactElement {
|
||||
|
||||
// Space or Enter toggles "save mnemonic" when that row is focused
|
||||
if (focusedSection === 'saveCheckbox') {
|
||||
if (input === ' ' || key.return) {
|
||||
if (_input === ' ' || key.return) {
|
||||
setSaveMnemonicChecked((v) => !v);
|
||||
return;
|
||||
}
|
||||
@@ -241,18 +241,6 @@ export function SeedInputScreen(): React.ReactElement {
|
||||
}
|
||||
}
|
||||
|
||||
// Ctrl-R generates a random seed phrase and fills it in the input
|
||||
if (key.ctrl && input === 'r') {
|
||||
setSeedPhrase(generateBip39Mnemonic());
|
||||
return;
|
||||
}
|
||||
|
||||
// If pressing enter while the generate random seed section is focused, generate a random seed and fill it in the input
|
||||
if (key.return && focusedSection === 'generateRandomSeed') {
|
||||
setSeedPhrase(generateBip39Mnemonic());
|
||||
return;
|
||||
}
|
||||
|
||||
// Enter on button submits manual seed
|
||||
if (key.return && focusedSection === 'button') {
|
||||
handleSubmit();
|
||||
@@ -370,19 +358,6 @@ export function SeedInputScreen(): React.ReactElement {
|
||||
/>
|
||||
</Box>
|
||||
|
||||
{/* Generate random seed phrase and fill in the input */}
|
||||
<Box marginTop={1}>
|
||||
<Box
|
||||
paddingX={1}
|
||||
paddingY={0}
|
||||
backgroundColor={focusedSection === 'generateRandomSeed' ? colors.focus : colors.bgSelected}
|
||||
>
|
||||
<Text color={focusedSection === 'generateRandomSeed' ? colors.bg : colors.text} bold>Generate Random Seed</Text>
|
||||
</Box>
|
||||
|
||||
<Text color={colors.textMuted}> (Ctrl-R)</Text>
|
||||
</Box>
|
||||
|
||||
{/* Save mnemonic checkbox (manual entry only; applies on Continue) */}
|
||||
<Box
|
||||
marginTop={1}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import type { Invitation } from "../services/invitation.js";
|
||||
import type { XOInvitationCommit, XOTemplate } from "@xo-cash/types";
|
||||
import type { XOTemplate } from "@xo-cash/types";
|
||||
|
||||
/**
|
||||
* Color names for invitation states.
|
||||
@@ -249,9 +249,9 @@ export function formatInvitationId(id: string, maxLength: number = 16): string {
|
||||
* @param invitation - The invitation to check
|
||||
* @returns Array of unique entity identifiers
|
||||
*/
|
||||
export function getInvitationParticipants(commits: Array<XOInvitationCommit>): string[] {
|
||||
export function getInvitationParticipants(invitation: Invitation): string[] {
|
||||
const participants = new Set<string>();
|
||||
for (const commit of commits) {
|
||||
for (const commit of invitation.data.commits || []) {
|
||||
if (commit.entityIdentifier) {
|
||||
participants.add(commit.entityIdentifier);
|
||||
}
|
||||
@@ -267,14 +267,9 @@ export function getInvitationParticipants(commits: Array<XOInvitationCommit>): s
|
||||
* @returns True if the user has made at least one commit
|
||||
*/
|
||||
export function isUserParticipant(
|
||||
invitation: Invitation | Array<XOInvitationCommit>,
|
||||
invitation: Invitation,
|
||||
userEntityId: string | null,
|
||||
): boolean {
|
||||
if (!userEntityId) return false;
|
||||
|
||||
if (Array.isArray(invitation)) {
|
||||
return invitation.some(commit => commit.entityIdentifier === userEntityId);
|
||||
}
|
||||
|
||||
return getInvitationParticipants(invitation.data.commits).includes(userEntityId);
|
||||
return getInvitationParticipants(invitation).includes(userEntityId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user