1
1
'use client' ;
2
2
3
- import { useQuery } from '@apollo/client' ;
4
- import { abi } from 'lib/abi' ;
5
- import { getTriplesWithMyPosition } from 'lib/queries' ;
6
- import { parseEther } from 'viem' ;
7
- import type { Address } from 'viem' ;
8
- import { useAccount , useWriteContract } from 'wagmi' ;
3
+ import { useQuery } from '@apollo/client' ;
4
+ import { abi } from 'lib/abi' ;
5
+ import { getTriplesWithMyPosition } from 'lib/queries' ;
6
+ import { parseEther } from 'viem' ;
7
+ import type { Address } from 'viem' ;
8
+ import { useAccount , useWriteContract } from 'wagmi' ;
9
9
10
- import { usePrivy } from '@privy-io/react-auth' ;
10
+ import { usePrivy } from '@privy-io/react-auth' ;
11
11
12
- import { AccountImage } from './AccountImage' ;
12
+ import { AccountImage } from './AccountImage' ;
13
13
14
14
const Triples = ( ) => {
15
- const { login} = usePrivy ( ) ;
15
+ const { login } = usePrivy ( ) ;
16
16
const account = useAccount ( ) ;
17
- const { writeContractAsync, isPending} = useWriteContract ( ) ;
17
+ const { writeContractAsync, isPending } = useWriteContract ( ) ;
18
18
19
- const { data, error, loading} = useQuery ( getTriplesWithMyPosition , {
19
+ const { data, error, loading } = useQuery ( getTriplesWithMyPosition , {
20
20
variables : {
21
21
predicateId : 6639 ,
22
22
subjectId : 535 ,
@@ -61,7 +61,7 @@ const Triples = () => {
61
61
< >
62
62
{ data . triples . map ( ( triple ) => {
63
63
const myPositionFor = triple . vault ?. myPosition ?. length !== 0 ;
64
- const myPositionAgainst = triple . counterVault ?. myPosition ?. length !== 0 ;
64
+ const myPositionAgainst = triple . counter_vault ?. myPosition ?. length !== 0 ;
65
65
66
66
return (
67
67
< div key = { triple . id } className = "mb-4" >
@@ -70,32 +70,31 @@ const Triples = () => {
70
70
71
71
< div className = "mb-2 flex gap-2" >
72
72
< button
73
- className = { `rounded border border-green-800 px-4 py-1 ${
74
- myPositionFor ? 'bg-green-800 text-white' : 'bg-green-200 text-black'
75
- } disabled:cursor-not-allowed disabled:opacity-50`}
73
+ className = { `rounded border border-green-800 px-4 py-1 ${ myPositionFor ? 'bg-green-800 text-white' : 'bg-green-200 text-black'
74
+ } disabled:cursor-not-allowed disabled:opacity-50`}
76
75
disabled = { isPending || myPositionAgainst }
77
76
onClick = { ( ) =>
78
77
myPositionFor
79
78
? handleRedeemTriple ( triple . vault ?. id , triple . vault ?. myPosition [ 0 ] . shares )
80
79
: handleDepositTriple ( triple . vault ?. id )
81
80
}
82
81
>
83
- 👍 { triple . vault ?. positionCount } { ' ' }
82
+ 👍 { triple . vault ?. position_count } { ' ' }
84
83
</ button >
85
84
< div className = "flex flex-row" >
86
85
{ triple . vault ?. myPosition . map ( ( position ) => (
87
86
< AccountImage
88
- key = { position . accountId }
89
- id = { position . accountId as Address }
87
+ key = { position . account_id }
88
+ id = { position . account_id as Address }
90
89
image = { position . account ?. image }
91
90
label = { position . account ?. label }
92
91
/>
93
92
) ) }
94
93
95
94
{ triple . vault ?. positions . map ( ( position ) => (
96
95
< AccountImage
97
- key = { position . accountId }
98
- id = { position . accountId as Address }
96
+ key = { position . account_id }
97
+ id = { position . account_id as Address }
99
98
image = { position . account ?. image }
100
99
label = { position . account ?. label }
101
100
/>
@@ -105,34 +104,33 @@ const Triples = () => {
105
104
106
105
< div className = "flex gap-2" >
107
106
< button
108
- className = { `rounded border border-red-800 px-4 py-1 ${
109
- myPositionAgainst ? 'bg-red-800 text-white' : 'bg-red-100 text-black'
110
- } disabled:cursor-not-allowed disabled:opacity-50 `}
107
+ className = { `rounded border border-red-800 px-4 py-1 ${ myPositionAgainst ? 'bg-red-800 text-white' : 'bg-red-100 text-black'
108
+ } disabled:cursor-not-allowed disabled:opacity-50 `}
111
109
disabled = { isPending || myPositionFor }
112
110
onClick = { ( ) =>
113
111
myPositionAgainst
114
112
? handleRedeemTriple (
115
- triple . counterVault ?. id ,
116
- triple . counterVault ?. myPosition [ 0 ] . shares ,
117
- )
118
- : handleDepositTriple ( triple . counterVault ?. id )
113
+ triple . counter_vault ?. id ,
114
+ triple . counter_vault ?. myPosition [ 0 ] . shares ,
115
+ )
116
+ : handleDepositTriple ( triple . counter_vault ?. id )
119
117
}
120
118
>
121
- 👎 { triple . counterVault ?. positionCount } { ' ' }
119
+ 👎 { triple . counter_vault ?. position_count } { ' ' }
122
120
</ button >
123
121
< div className = "flex flex-row" >
124
- { triple . counterVault ?. myPosition . map ( ( position ) => (
122
+ { triple . counter_vault ?. myPosition . map ( ( position ) => (
125
123
< AccountImage
126
- key = { position . accountId }
127
- id = { position . accountId as Address }
124
+ key = { position . account_id }
125
+ id = { position . account_id as Address }
128
126
image = { position . account ?. image }
129
127
label = { position . account ?. label }
130
128
/>
131
129
) ) }
132
- { triple . counterVault ?. positions . map ( ( position ) => (
130
+ { triple . counter_vault ?. positions . map ( ( position ) => (
133
131
< AccountImage
134
- key = { position . accountId }
135
- id = { position . accountId as Address }
132
+ key = { position . account_id }
133
+ id = { position . account_id as Address }
136
134
image = { position . account ?. image }
137
135
label = { position . account ?. label }
138
136
/>
0 commit comments