Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation #12

Merged
merged 66 commits into from
Jan 8, 2025
Merged
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
12d425d
Update agent.ts
madschristensen99 Jan 7, 2025
b21e28d
Update agent.ts
madschristensen99 Jan 7, 2025
043230a
Update agent.ts
madschristensen99 Jan 7, 2025
b0313c8
Update get-tool-for-intent.ts
madschristensen99 Jan 7, 2025
e24db7c
Update get-tool-matching-prompt.ts
madschristensen99 Jan 7, 2025
a434c0e
Update parse-tool-parameters.ts
madschristensen99 Jan 7, 2025
d2161ad
Update add-delegatee.ts
madschristensen99 Jan 7, 2025
9e9201f
Update batch-add-delegatee.ts
madschristensen99 Jan 7, 2025
54d6148
Update batch-remove-delegatee.ts
madschristensen99 Jan 7, 2025
badc55f
Update get-delegatees.ts
madschristensen99 Jan 7, 2025
798b136
Update get-tool-policy.ts
madschristensen99 Jan 7, 2025
4415756
Update get-tools.ts
madschristensen99 Jan 7, 2025
69dc32c
Update is-delegatee.ts
madschristensen99 Jan 7, 2025
cd761e9
Update permit-tool.ts
madschristensen99 Jan 7, 2025
57aaaae
Update remove-delegatee.ts
madschristensen99 Jan 7, 2025
9865801
Update remove-tool-policy.ts
madschristensen99 Jan 7, 2025
c9f578f
Update remove-tool.ts
madschristensen99 Jan 7, 2025
0b208cd
Update set-tool-policy.ts
madschristensen99 Jan 7, 2025
4f1bbe9
Update execute-tool.ts
madschristensen99 Jan 7, 2025
67e9e49
Update get-delegated-pkps.ts
madschristensen99 Jan 7, 2025
344b7a6
Update get-registered-tools.ts
madschristensen99 Jan 7, 2025
d896ca4
Update get-tool-policy.ts
madschristensen99 Jan 7, 2025
070e618
Update batch-add-delegatee.ts
madschristensen99 Jan 7, 2025
b5d53b2
Update batch-remove-delegatee.ts
madschristensen99 Jan 7, 2025
d1b0a8f
Update delegatee-address.ts
madschristensen99 Jan 7, 2025
88cd1fa
Update init.ts
madschristensen99 Jan 7, 2025
18c20a8
Update insufficient-balance.ts
madschristensen99 Jan 7, 2025
7ad13a4
Update menu.ts
madschristensen99 Jan 7, 2025
8060b91
Update permit-tool.ts
madschristensen99 Jan 7, 2025
2e2820d
Update policy-details.ts
madschristensen99 Jan 7, 2025
e13b8c8
Update remove-delegatee.ts
madschristensen99 Jan 7, 2025
7b2ef78
Update remove-tool.ts
madschristensen99 Jan 7, 2025
2a1e132
Update init.ts
madschristensen99 Jan 7, 2025
17ac17b
Update insufficient-balance.ts
madschristensen99 Jan 7, 2025
80eadd8
Update menu.ts
madschristensen99 Jan 7, 2025
6cfbb70
Update select-pkp.ts
madschristensen99 Jan 7, 2025
d7364a0
Update select-tool.ts
madschristensen99 Jan 7, 2025
f7dcc19
Update tool-params.ts
madschristensen99 Jan 7, 2025
223abb0
Update select-lit-network.ts
madschristensen99 Jan 7, 2025
331f573
Update select-role.ts
madschristensen99 Jan 7, 2025
fe1beae
Update admin.ts
madschristensen99 Jan 7, 2025
6d5afc0
Update delegatee.ts
madschristensen99 Jan 7, 2025
d059a0b
Update admin.ts
madschristensen99 Jan 7, 2025
ff4fade
Update delegatee.ts
madschristensen99 Jan 7, 2025
970b80a
Update errors.ts
madschristensen99 Jan 7, 2025
9739e00
Update types.ts
madschristensen99 Jan 7, 2025
c8fa555
Update ipfs.ts
madschristensen99 Jan 7, 2025
b739e04
Update lit-action.ts
madschristensen99 Jan 7, 2025
6d931eb
Update policy.ts
madschristensen99 Jan 7, 2025
f5da59d
Update tool.ts
madschristensen99 Jan 7, 2025
d9cf03e
Update errors.ts
madschristensen99 Jan 7, 2025
cba86f5
Update registry.ts
madschristensen99 Jan 7, 2025
755a8dc
Update ipfs.ts
madschristensen99 Jan 7, 2025
282dafa
Update lit-action.ts
madschristensen99 Jan 7, 2025
8705114
Update policy.ts
madschristensen99 Jan 7, 2025
91aad5a
Update tool.ts
madschristensen99 Jan 7, 2025
ce6a5c5
Update ipfs.ts
madschristensen99 Jan 7, 2025
32ecf25
Update lit-action.ts
madschristensen99 Jan 7, 2025
b8a34af
Update networks.ts
madschristensen99 Jan 7, 2025
8c45ef5
Update policy.ts
madschristensen99 Jan 7, 2025
635d780
Update tool.ts
madschristensen99 Jan 7, 2025
b181cc8
Update tool.ts
madschristensen99 Jan 7, 2025
824908b
Update errors.ts
madschristensen99 Jan 7, 2025
0a40b96
Add files via upload
madschristensen99 Jan 7, 2025
8b7a126
Add files via upload
madschristensen99 Jan 7, 2025
95fe753
Merge branch 'main' into main
madschristensen99 Jan 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update batch-add-delegatee.ts
madschristensen99 authored Jan 7, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 9e9201fe9ef4dc75f6763ea08552cf20c693dc80
31 changes: 30 additions & 1 deletion packages/fss-cli/src/lib/handlers/admin/batch-add-delegatee.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,56 @@
// Import the FssAdmin type from the '@lit-protocol/full-self-signing' package.
import { type Admin as FssAdmin } from '@lit-protocol/full-self-signing';

// Import the logger utility for logging messages.
import { logger } from '../../utils/logger';

// Import custom error types and utilities.
import { FssCliError, FssCliErrorType } from '../../errors';
import { promptSelectDelegateesToAdd } from '../../prompts/admin';

/**
* Adds multiple delegatees to the Full Self-Signing (FSS) system in a batch operation.
* This function logs the progress and success of the operation.
*
* @param fssAdmin - An instance of the FssAdmin class.
* @param addresses - An array of delegatee addresses to add.
*/
const batchAddDelegatees = async (fssAdmin: FssAdmin, addresses: string[]) => {
// Log a loading message to indicate the operation is in progress.
logger.loading('Adding delegatees...');

// Add the delegatees to the FSS system in a batch operation.
await fssAdmin.batchAddDelegatees(addresses);
logger.success('Successfully added delegatees');

// Log a success message once the delegatees are added.
logger.success('Successfully added delegatees.');
};

/**
* Handles the process of adding multiple delegatees to the FSS system in a batch operation.
* This function prompts the user to select delegatee addresses, adds the delegatees,
* and handles any errors that occur during the process.
*
* @param fssAdmin - An instance of the FssAdmin class.
*/
export const handleBatchAddDelegatee = async (fssAdmin: FssAdmin) => {
try {
// Prompt the user to select delegatee addresses.
const addresses = await promptSelectDelegateesToAdd();

// Add the selected delegatees to the FSS system.
await batchAddDelegatees(fssAdmin, addresses);
} catch (error) {
// Handle specific errors related to batch delegatee addition.
if (error instanceof FssCliError) {
if (error.type === FssCliErrorType.ADMIN_BATCH_ADD_DELEGATEE_CANCELLED) {
// Log an error message if the user cancels the operation.
logger.error('Batch delegatee addition cancelled.');
return;
}
}

// Re-throw any other errors to be handled by the caller.
throw error;
}
};