@@ -34,11 +34,13 @@ import { deletePerunRequest } from 'states/stateProvider/actionCreators'
3434import styles from './perunCreationRequestList.module.scss'
3535import { getCompatibleTx } from './utils'
3636import Token from 'components/PaymentChannel/components/Token'
37+ import { useChannelInfoMap } from 'components/PaymentChannel/hooks'
3738
3839type PerunRequestListProps = {
3940 requests : Perun . ReadableMessage . Request [ ]
4041 onCancel : ( ) => void
4142 walletID : string
43+ channelInfoMap : ReturnType < typeof useChannelInfoMap >
4244 onOpenChannel : ( request : Perun . ReadableMessage . OpenChannelRequest ) => void
4345 onUpdateChannel : ( request : Perun . ReadableMessage . UpdateNotificationRequest ) => void
4446}
@@ -50,6 +52,7 @@ export const PerunCreationRequestList = (props: PerunRequestListProps) => {
5052 walletID,
5153 onOpenChannel,
5254 onUpdateChannel,
55+ channelInfoMap,
5356 } = props
5457 const [ t ] = useTranslation ( )
5558 const [ showPasswordDialog , setShowPasswordDialog ] = useState ( false )
@@ -133,26 +136,31 @@ export const PerunCreationRequestList = (props: PerunRequestListProps) => {
133136 case "UpdateNotification" : {
134137 console . log ( 'UpdateNotification request: ' , perunRequest . request )
135138 const channelState = perunRequest . request . state ;
139+ const info = channelInfoMap . get ( channelState ! . id ) ;
140+ const myPayloadIndex = info ?. myPayloadIndex ?? 1
136141 return (
137142 < >
138143 < h3 className = 'my-0' > Update Notification</ h3 >
139144 < p > { `Channel ID: ${ channelState ?. id } ` } </ p >
140145 < div className = 'flex flex-row gap-4 mt-2' >
141146 < div >
142- < div className = 'text-secondary' > Who's Token Locked</ div >
147+ < div className = 'text-secondary' > My Token Locked</ div >
143148 < div className = 'mt-1' >
144- < Token type = { null } amount = { channelState ?. allocation ?. balances ?. balances [ 0 ] . balance [ 0 ] ?? "0" } />
149+ < Token type = { null } amount = { channelState ?. allocation ?. balances ?. balances [ 0 ] . balance [ myPayloadIndex ] ?? "0" } />
145150 </ div >
146151 </ div >
147152 < div >
148- < div className = 'text-secondary' > Who's Token Locked</ div >
153+ < div className = 'text-secondary' > Peer Token Locked</ div >
149154 < div className = 'mt-1' >
150- < Token type = { null } amount = { channelState ?. allocation ?. balances ?. balances [ 0 ] . balance [ 1 ] ?? "0" } />
155+ < Token type = { null } amount = { channelState ?. allocation ?. balances ?. balances [ 0 ] . balance [ 1 - myPayloadIndex ] ?? "0" } />
156+ </ div >
157+ </ div >
158+ < div >
159+ < div className = 'text-secondary' > isFinal</ div >
160+ < div className = 'mt-1' >
161+ { channelState ?. isFinal === true ? 'true' : 'false' }
151162 </ div >
152163 </ div >
153- </ div >
154- < div >
155- isFinal: { channelState ?. isFinal === true ? 'true' : 'false' }
156164 </ div >
157165 </ >
158166 )
0 commit comments