Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QSI_Groupe4
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lydia Tarmelit
QSI_Groupe4
Commits
9d2258f8
Commit
9d2258f8
authored
1 year ago
by
Nawfel Senoussi
Browse files
Options
Downloads
Patches
Plain Diff
fix views caller
parent
fcce0dd6
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
index.ts
+4
-0
4 additions, 0 deletions
index.ts
src/services/association.service.ts
+10
-9
10 additions, 9 deletions
src/services/association.service.ts
src/utils/getRole.ts
+1
-1
1 addition, 1 deletion
src/utils/getRole.ts
with
15 additions
and
10 deletions
index.ts
+
4
−
0
View file @
9d2258f8
...
...
@@ -63,12 +63,16 @@ program.command('main')
})
break
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
'
]
await
inquirer
.
prompt
(
questions
).
then
(
async
(
answers
:
{
choice
:
string
})
=>
{
await
handleAdherentChoice
(
answers
.
choice
,
tezos
)
})
break
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
'
]
await
inquirer
.
prompt
(
questions
).
then
(
async
(
answers
:
{
choice
:
string
})
=>
{
await
handleConnectedChoice
(
answers
.
choice
,
tezos
)
...
...
This diff is collapsed.
Click to expand it.
src/services/association.service.ts
+
10
−
9
View file @
9d2258f8
...
...
@@ -2,7 +2,7 @@ import { type Operation, type TezosToolkit } from '@taquito/taquito'
import
{
type
Association
}
from
'
../types/Association
'
// NEED UPDATE ADDRESS !! (SMART CONTRACT 1: Registre des associations)
const
address
=
'
KT1
P9oYuywTFUNQvFiWhcWN329R2AgpQv2CV
'
const
address
=
'
KT1
HEyhspXn3Bt2opakTvaRFkwSMZbmqvXGM
'
const
mockAssociations
:
Association
[]
=
[
{
...
...
@@ -19,7 +19,9 @@ async function createAssociation (association: Association, tezos: TezosToolkit)
const
contract
=
await
tezos
.
contract
.
at
(
address
)
const
op
:
Operation
=
await
contract
.
methodsObject
.
registerAssociation
(
association
).
send
()
await
op
.
confirmation
()
console
.
log
(
op
.
hash
)
}
// NEED UPDATE ENTRYPOINT !!
...
...
@@ -43,15 +45,14 @@ async function getAssociations (tezos: TezosToolkit): Promise<string[]> {
}
async
function
getAssociationDetails
(
associationName
:
string
,
tezos
:
TezosToolkit
):
Promise
<
Association
>
{
// const executionContextParams = {
// viewCaller: ''
// }
// const contract = await tezos.contract.at(address)
// const associationDetails: Association = await contract.contractViews.listDetailsAssociations(associationName).executeView(executionContextParams)
// return associationDetails
const
contract
=
await
tezos
.
contract
.
at
(
address
)
// MOCK
return
mockAssociations
.
find
((
association
)
=>
association
.
name
===
associationName
)
const
executionContextParams
=
{
viewCaller
:
contract
.
address
}
const
associationDetails
:
Association
=
await
contract
.
contractViews
.
listDetailsAssociations
(
associationName
).
executeView
(
executionContextParams
)
return
associationDetails
}
export
{
createAssociation
,
joinAssociation
,
getAssociations
,
getAssociationDetails
}
This diff is collapsed.
Click to expand it.
src/utils/getRole.ts
+
1
−
1
View file @
9d2258f8
...
...
@@ -9,5 +9,5 @@ export function getRole (tezos: TezosToolkit): Role {
// ELSE -> CONNECTED
// TEMPORARY
return
'
ADMIN_ASSOCIATION
'
return
'
CONNECTED
'
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment