Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 38x 38x 38x 38x 38x 38x 38x 38x 10x 10x 38x | import { Cardano, NotImplementedError } from '@cardano-sdk/core'; import { Command } from 'commander'; import { addOptions, newOption } from './util'; import { readFile } from 'fs/promises'; const handlePolicyIdsParser = (policyIds: string) => policyIds.split(',').map(Cardano.PolicyId); export enum HandlePolicyIdsOptionDescriptions { HandlePolicyIds = 'Handle policy Ids', HandlePolicyIdsFile = 'Handle policy Ids file' } export interface HandlePolicyIdsProgramOptions { handlePolicyIds: Cardano.PolicyId[]; handlePolicyIdsFile?: string; } export const handlePolicyIdsFromFile = async (args: HandlePolicyIdsProgramOptions) => { const { handlePolicyIdsFile } = args; if (!handlePolicyIdsFile) return; args.handlePolicyIds = handlePolicyIdsParser( (await readFile(handlePolicyIdsFile, { encoding: 'utf8' })).replace(/\s/g, '') ); }; export const withHandlePolicyIdsOptions = (command: Command, maxPolicyIdsSupported?: number) => addOptions(command, [ newOption( '--handle-policy-ids <handlePolicyIds>', HandlePolicyIdsOptionDescriptions.HandlePolicyIds, 'HANDLE_POLICY_IDS', (policyIds: string) => { const policyIdsArray = handlePolicyIdsParser(policyIds); Iif (maxPolicyIdsSupported && policyIdsArray.length > maxPolicyIdsSupported) throw new NotImplementedError(`${policyIdsArray.length} policyIds are not supported`); return policyIdsArray; } ), newOption( '--handle-policy-ids-file <handlePolicyIdsFile>', HandlePolicyIdsOptionDescriptions.HandlePolicyIdsFile, 'HANDLE_POLICY_IDS_FILE' ).conflicts('handlePolicyIds') ]); |