Skip to content

Commit

Permalink
Merge branch 'master' into illia-malachyn/784-add-more-examples
Browse files Browse the repository at this point in the history
  • Loading branch information
illia-malachyn committed Nov 5, 2024
2 parents 5367639 + 5b17d2d commit 526381d
Show file tree
Hide file tree
Showing 33 changed files with 502 additions and 684 deletions.
4 changes: 2 additions & 2 deletions access/grpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,11 @@ func (c *Client) GetAccountKeyAtBlockHeight(ctx context.Context, address flow.Ad
return c.grpc.GetAccountKeyAtBlockHeight(ctx, address, keyIndex, height)
}

func (c *Client) GetAccountKeysAtLatestBlock(ctx context.Context, address flow.Address) ([]flow.AccountKey, error) {
func (c *Client) GetAccountKeysAtLatestBlock(ctx context.Context, address flow.Address) ([]*flow.AccountKey, error) {
return c.grpc.GetAccountKeysAtLatestBlock(ctx, address)
}

func (c *Client) GetAccountKeysAtBlockHeight(ctx context.Context, address flow.Address, height uint64) ([]flow.AccountKey, error) {
func (c *Client) GetAccountKeysAtBlockHeight(ctx context.Context, address flow.Address, height uint64) ([]*flow.AccountKey, error) {
return c.grpc.GetAccountKeysAtBlockHeight(ctx, address, height)
}

Expand Down
14 changes: 9 additions & 5 deletions access/grpc/convert/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,16 @@ func MessageToAccountKey(m *entities.AccountKey) (*flow.AccountKey, error) {
}, nil
}

func MessageToAccountKeys(m []*entities.AccountKey) ([]flow.AccountKey, error) {
var accountKeys []flow.AccountKey
func MessageToAccountKeys(m []*entities.AccountKey) ([]*flow.AccountKey, error) {
var accountKeys []*flow.AccountKey

for _, entity := range m {
accountKey, err := MessageToAccountKey(entity)
if err != nil {
return nil, err
}

accountKeys = append(accountKeys, *accountKey)
accountKeys = append(accountKeys, accountKey)
}

return accountKeys, nil
Expand Down Expand Up @@ -347,12 +347,16 @@ func QuorumCertificateToMessage(qc flow.QuorumCertificate) (*entities.QuorumCert
}, nil
}

func MessageToBlockDigest(m *access.SubscribeBlockDigestsResponse) flow.BlockDigest {
func MessageToBlockDigest(m *access.SubscribeBlockDigestsResponse) (flow.BlockDigest, error) {
if m == nil {
return flow.BlockDigest{}, ErrEmptyMessage
}

return flow.BlockDigest{
BlockID: flow.BytesToID(m.GetBlockId()),
Height: m.GetBlockHeight(),
Timestamp: m.GetBlockTimestamp().AsTime(),
}
}, nil
}

func BlockDigestToMessage(blockDigest flow.BlockDigest) *access.SubscribeBlockDigestsResponse {
Expand Down
Loading

0 comments on commit 526381d

Please sign in to comment.