Skip to content

Commit

Permalink
v0.3.3, solana height is slot
Browse files Browse the repository at this point in the history
  • Loading branch information
superisaac committed Dec 27, 2023
1 parent e4d2cb8 commit c3fad3d
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions chains/solana.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@ import (
"net/http"
)

type solanaBlock struct {
Value struct {
Blockhash string
LastValidBlockHeight int `json:"lastValidBlockHeight"`
}

Context struct {
Slot int
}
}

type SolanaChain struct {
}

Expand All @@ -34,17 +23,17 @@ func (self SolanaChain) StartSync(context context.Context, m *nodemuxcore.Multip
}

func (self *SolanaChain) GetBlockhead(context context.Context, m *nodemuxcore.Multiplexer, ep *nodemuxcore.Endpoint) (*nodemuxcore.Block, error) {
config := map[string]string{"commitement": "confirmed"}
reqmsg := jsoff.NewRequestMessage(
1, "getLatestBlockhash", []interface{}{})
1, "getSlot", []interface{}{config})

var bt solanaBlock
err := ep.UnwrapCallRPC(context, reqmsg, &bt)
var slot int
err := ep.UnwrapCallRPC(context, reqmsg, &slot)
if err != nil {
return nil, err
}
block := &nodemuxcore.Block{
Height: bt.Value.LastValidBlockHeight,
Hash: bt.Value.Blockhash,
Height: slot,
}
return block, nil
}
Expand Down

0 comments on commit c3fad3d

Please sign in to comment.