88 lines
3.6 KiB
TypeScript
88 lines
3.6 KiB
TypeScript
/**
|
|
* Approval workflow for sensitive platform fund operations (N-of-M + auto-execute).
|
|
*/
|
|
import type { FundOperationRequestRow, FundOperationStatus, FundOperationType } from '../repositories/fundOperationRequestRepository';
|
|
import * as approvalPolicyRepository from '../repositories/approvalPolicyRepository';
|
|
import type { PolicyInput, QuorumSlot } from '../repositories/approvalPolicyRepository';
|
|
import type { RoleName } from '../models';
|
|
export declare class FundApprovalError extends Error {
|
|
constructor(message: string);
|
|
}
|
|
export type FundRequestVoteDto = {
|
|
voterId: string;
|
|
decision: 'approve' | 'reject';
|
|
reason: string | null;
|
|
voterRoles: string[];
|
|
createdAt: string;
|
|
};
|
|
export type FundRequestDto = {
|
|
id: string;
|
|
operationType: FundOperationType;
|
|
status: FundOperationStatus;
|
|
payload: Record<string, unknown>;
|
|
requestedBy: string;
|
|
approvedBy: string | null;
|
|
rejectionReason: string | null;
|
|
executionResult: Record<string, unknown> | null;
|
|
createdAt: string;
|
|
approvedAt: string | null;
|
|
executedAt: string | null;
|
|
policyId: string | null;
|
|
policyName: string | null;
|
|
requiredQuorum: QuorumSlot[];
|
|
forbidSelfApprove: boolean;
|
|
amountRaw: string | null;
|
|
assetCode: string | null;
|
|
network: string | null;
|
|
fromAddress: string | null;
|
|
toAddress: string | null;
|
|
votes: FundRequestVoteDto[];
|
|
quorumProgress: {
|
|
required: number;
|
|
approved: number;
|
|
};
|
|
canVote: boolean;
|
|
};
|
|
export declare function executeApprovedRequest(request: FundOperationRequestRow, approverId: string): Promise<Record<string, unknown>>;
|
|
export declare function createFundRequest(input: {
|
|
operationType: FundOperationType;
|
|
payload: Record<string, unknown>;
|
|
requestedBy: string;
|
|
/** Skip fund_operation.request check (e.g. user withdrawal). */
|
|
skipRequestPermission?: boolean;
|
|
/** Force queue even if policy says auto (unused reserved). */
|
|
forceQueue?: boolean;
|
|
}): Promise<FundRequestDto & {
|
|
autoExecuted?: boolean;
|
|
}>;
|
|
export declare function castVote(requestId: string, voterId: string, decision: 'approve' | 'reject', reason?: string): Promise<FundRequestDto>;
|
|
export declare function approveFundRequest(requestId: string, approverId: string): Promise<FundRequestDto>;
|
|
export declare function rejectFundRequest(requestId: string, approverId: string, reason: string): Promise<FundRequestDto>;
|
|
export declare function cancelFundRequest(requestId: string, actorId: string): Promise<FundRequestDto>;
|
|
export declare function getFundRequest(requestId: string, viewerId?: string): Promise<FundRequestDto | null>;
|
|
export declare function listFundRequests(filters: {
|
|
status?: FundOperationStatus;
|
|
operationType?: FundOperationType;
|
|
limit?: number;
|
|
offset?: number;
|
|
}, viewerId?: string): Promise<{
|
|
items: FundRequestDto[];
|
|
total: number;
|
|
}>;
|
|
/** Submit a full policy set replacement via Approvals (does not apply immediately). */
|
|
export declare function draftPolicyChange(input: {
|
|
after: PolicyInput[];
|
|
note?: string;
|
|
requestedBy: string;
|
|
}): Promise<FundRequestDto>;
|
|
export declare function listApprovalPolicies(actorId: string): Promise<approvalPolicyRepository.ApprovalPolicyRow[]>;
|
|
export declare function listPolicyRevisions(actorId: string, limit?: number): Promise<approvalPolicyRepository.ApprovalPolicyRevisionRow[]>;
|
|
export type UserRoleName = RoleName;
|
|
export declare function updateUserRoles(targetUserId: string, roleNames: string[], adminUserId: string, notifyCtx?: {
|
|
ipAddress?: string;
|
|
userAgent?: string;
|
|
}): Promise<{
|
|
userId: string;
|
|
roles: string[];
|
|
}>;
|
|
//# sourceMappingURL=fundApprovalService.d.ts.map
|