Skip to content
Snippets Groups Projects
Commit 9d2258f8 authored by Nawfel Senoussi's avatar Nawfel Senoussi
Browse files

fix views caller

parent fcce0dd6
No related branches found
No related tags found
No related merge requests found
...@@ -63,12 +63,16 @@ program.command('main') ...@@ -63,12 +63,16 @@ program.command('main')
}) })
break break
case 'ADHERENT': case 'ADHERENT':
// VOTER POUR UNE PROPOSITION
// CLOTURER ET RESOUDRE LES PROPOSITIONS DONT IL EST LE CREATEUR
// SI A UN TOKEN IL PEUT LE BRULER
questions[0].choices = ['Faire une proposition', 'Créer un token', 'Voir mon portefeuille'] questions[0].choices = ['Faire une proposition', 'Créer un token', 'Voir mon portefeuille']
await inquirer.prompt(questions).then(async (answers: { choice: string }) => { await inquirer.prompt(questions).then(async (answers: { choice: string }) => {
await handleAdherentChoice(answers.choice, tezos) await handleAdherentChoice(answers.choice, tezos)
}) })
break break
case 'CONNECTED': case 'CONNECTED':
// CREE UNE ASSO SI A UN TOKEN
questions[0].choices = ['Rejoindre une association', 'Créer un token', 'Voir les associations', "Voir les détails d'une association", 'Voir mon portefeuille'] questions[0].choices = ['Rejoindre une association', 'Créer un token', 'Voir les associations', "Voir les détails d'une association", 'Voir mon portefeuille']
await inquirer.prompt(questions).then(async (answers: { choice: string }) => { await inquirer.prompt(questions).then(async (answers: { choice: string }) => {
await handleConnectedChoice(answers.choice, tezos) await handleConnectedChoice(answers.choice, tezos)
......
...@@ -2,7 +2,7 @@ import { type Operation, type TezosToolkit } from '@taquito/taquito' ...@@ -2,7 +2,7 @@ import { type Operation, type TezosToolkit } from '@taquito/taquito'
import { type Association } from '../types/Association' import { type Association } from '../types/Association'
// NEED UPDATE ADDRESS !! (SMART CONTRACT 1: Registre des associations) // NEED UPDATE ADDRESS !! (SMART CONTRACT 1: Registre des associations)
const address = 'KT1P9oYuywTFUNQvFiWhcWN329R2AgpQv2CV' const address = 'KT1HEyhspXn3Bt2opakTvaRFkwSMZbmqvXGM'
const mockAssociations: Association[] = [ const mockAssociations: Association[] = [
{ {
...@@ -19,7 +19,9 @@ async function createAssociation (association: Association, tezos: TezosToolkit) ...@@ -19,7 +19,9 @@ async function createAssociation (association: Association, tezos: TezosToolkit)
const contract = await tezos.contract.at(address) const contract = await tezos.contract.at(address)
const op: Operation = await contract.methodsObject.registerAssociation(association).send() const op: Operation = await contract.methodsObject.registerAssociation(association).send()
await op.confirmation() await op.confirmation()
console.log(op.hash)
} }
// NEED UPDATE ENTRYPOINT !! // NEED UPDATE ENTRYPOINT !!
...@@ -43,15 +45,14 @@ async function getAssociations (tezos: TezosToolkit): Promise<string[]> { ...@@ -43,15 +45,14 @@ async function getAssociations (tezos: TezosToolkit): Promise<string[]> {
} }
async function getAssociationDetails (associationName: string, tezos: TezosToolkit): Promise<Association> { async function getAssociationDetails (associationName: string, tezos: TezosToolkit): Promise<Association> {
// const executionContextParams = { const contract = await tezos.contract.at(address)
// viewCaller: ''
// }
// const contract = await tezos.contract.at(address)
// const associationDetails: Association = await contract.contractViews.listDetailsAssociations(associationName).executeView(executionContextParams)
// return associationDetails
// MOCK const executionContextParams = {
return mockAssociations.find((association) => association.name === associationName) viewCaller: contract.address
}
const associationDetails: Association = await contract.contractViews.listDetailsAssociations(associationName).executeView(executionContextParams)
return associationDetails
} }
export { createAssociation, joinAssociation, getAssociations, getAssociationDetails } export { createAssociation, joinAssociation, getAssociations, getAssociationDetails }
...@@ -9,5 +9,5 @@ export function getRole (tezos: TezosToolkit): Role { ...@@ -9,5 +9,5 @@ export function getRole (tezos: TezosToolkit): Role {
// ELSE -> CONNECTED // ELSE -> CONNECTED
// TEMPORARY // TEMPORARY
return 'ADMIN_ASSOCIATION' return 'CONNECTED'
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment