Files
prime-sdk-go/block/block.go
Andrew Miller e15b205f9c Add remote smart contract and gRPC connection support
Add Remote field to SmartContractCreateRequest and GrpcConnectionInfo
struct to SmartContract model for remote smart contract execution
via gRPC.
2026-02-11 11:20:21 -05:00

28 lines
581 B
Go
Executable File

package block
import (
"context"
"fmt"
"git.dragonchain.com/dragonchain/dragonchain-prime-sdk-go/client"
"git.dragonchain.com/dragonchain/dragonchain-prime-sdk-go/models"
)
type BlockClient struct {
client *client.Client
}
func NewBlockClient(c *client.Client) *BlockClient {
return &BlockClient{client: c}
}
func (bc *BlockClient) Get(ctx context.Context, blockID string) (*models.Block, error) {
var resp models.Block
path := fmt.Sprintf("/api/v1/block/%s", blockID)
err := bc.client.Get(ctx, path, &resp)
if err != nil {
return nil, err
}
return &resp, nil
}