Working with Statechunks is fiddly, so the easiest way to work with them is to use Ultraschall-Api for this.
In Ultraschall-Api, I have added tons of functions, that allow passing a statechunk as parameter to get and to set the values in there.
For instance, if you want to get and set the current trackheight of a TrackStateChunk, you can use GetTrackHeightState and SetTrackHeightState:
https://mespotin.uber.space/Ultrasch...ackHeightState
https://mespotin.uber.space/Ultrasch...ackHeightState
You get a TrackStateChunk with reaper.GetTrackStateChunk and you can commit a TrackStateChunk back into a track with reaper.SetTrackStateChunk.
The functions of Ultraschall-Api who probably support TrackStateChunks begin with GetTrackXXX and SetTrackXXX, where XXX is the name of the state.
Look in the functionindex in the docs for Track Management -> Get Track States and Set Track States for a list of them.
https://mespotin.uber.space/Ultrasch...Functions.html
If you have a specific statechunk-entry you want to get/set, you can also look for the statechunk-entry's name in the docs, for instance TRACKHEIGHT to find the functions, who deal with the TRACKHEIGHT-statechunk-entry.