dapperlabs/nba-smart-contracts

Error fetching minted moment on mainnet4 using flow go sdk

Closed this issue · 1 comments

Describe the bug
Error fetching minted moment on mainnet4

panic: error fetching minted moment from flow: client: rpc error: code = Internal desc = failed to execute the script on the execution node: rpc error: code = Internal desc = failed to execute script: failed to get state commitment for block (563530a19cd7d1e7e1c0935a137f0af50b5ac52513c47e5773797e7fd3c77fda): could not retrieve resource: key not found

To Reproduce
Steps to reproduce the behavior:

getMomentScript := `
		import TopShot from 0x0b2a3299cc857e29
        pub struct Moment {
          pub var id: UInt64
          pub var playId: UInt32
          pub var play: {String: String}
          pub var setId: UInt32
          pub var setName: String
		  pub var series: UInt32
          pub var serialNumber: UInt32
          init(id:UInt64, playId:UInt32, setId:UInt32, serialNumber:UInt32) {
            self.id = id
            self.playId = playId
            self.play = TopShot.getPlayMetaData(playID: self.playId)!
            self.setId = setId
            self.setName = TopShot.getSetName(setID: self.setId)!
			self.series = TopShot.getSetSeries(setID: self.setId)!
            self.serialNumber = serialNumber
          }
        }
		pub fun main(id: UInt64, playId: UInt32, setId: UInt32, serialNumber: UInt32): Moment {
			return Moment(id: id, playId: playId, setId: setId, serialNumber: serialNumber)
		}
`
  1. ExecuteScriptAtBlockHeight in flow go api
  // fetch latest block
	latestBlock, err := FlowClient.GetLatestBlock(context.Background(), false)
	if err != nil {
		return nil, fmt.Errorf("error fetching block from flow: %w", err)
	}
      res, err := FlowClient.ExecuteScriptAtBlockHeight(context.Background(), latestBlock.Height, []byte(getMomentScript), 
                []cadence.Value{
		cadence.UInt64(772738),
		cadence.UInt32(276),
		cadence.UInt32(2),
		cadence.UInt32(1129),
	})

Expected behavior
Return Moment

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • Ubuntu 18.04.5

Additional context
Add any other context about the problem here.

I think this is more of a Flow error, and not a top shot error, so I am going to close this issue