Skip to content
Snippets Groups Projects
Select Git revision
  • 10b940badd5507990d63c77c18a172e578d05bdc
  • main default protected
2 results

roleHandlers.ts

Blame
  • roleHandlers.ts 3.33 KiB
    import { type TezosToolkit } from '@taquito/taquito'
    import { handleBurnToken, handleCreateAssociation, handleCreateProposal, handleCreateToken, handleGetAssociations, handleGetBalance, handleJoinAssociation } from './handlers'
    import chalk from 'chalk'
    
    /**
     * Handles fa token administrator actions based on the specified choice.
     * @param {string} choice - The administrator's choice.
     * @param {TezosToolkit} tezos - The TezosToolkit instance used for blockchain operations.
     * @returns {Promise<void>} A promise resolved once the processing is complete.
     */
    async function handleAdminFATokenChoice (choice: string, tezos: TezosToolkit): Promise<void> {
      switch (choice) {
        case '0':
          break
        case '1':
          await handleCreateAssociation(tezos)
          break
        case '2':
          await handleCreateToken(tezos)
          break
        case '3':
          await handleBurnToken(tezos)
          break
        case '4':
          await handleGetBalance(tezos)
          break
        default:
          console.log(chalk.bgRedBright('\nChoix invalide\n'))
          break
      }
    }
    
    /**
       * Handles association administrator actions based on the specified choice.
       * @param {string} choice - The administrator's choice.
       * @param {TezosToolkit} tezos - The TezosToolkit instance used for blockchain operations.
       * @returns {Promise<void>} A promise resolved once the processing is complete.
       */
    async function handleAdminAssociationChoice (choice: string, tezos: TezosToolkit): Promise<void> {
      switch (choice) {
        case '0':
          break
        case '1':
          await handleCreateToken(tezos)
          break
        case '2':
          await handleBurnToken(tezos)
          break
        case '3':
          await handleGetBalance(tezos)
          break
        default:
          console.log(chalk.bgRedBright('\nChoix invalide\n'))
          break
      }
    }
    
    /**
       * Handles adherent actions based on the specified choice.
       * @param {string} choice - The adherent's choice.
       * @param {TezosToolkit} tezos - The TezosToolkit instance used for blockchain operations.
       * @returns {Promise<void>} A promise resolved once the processing is complete.
       */
    async function handleAdherentChoice (choice: string, tezos: TezosToolkit): Promise<void> {
      switch (choice) {
        case '0':
          break
        case '1':
          await handleCreateProposal(tezos)
          break