mirror of
https://github.com/luxfi/platformvm.git
synced 2026-10-30 15:22:12 +00:00
- Drop atomic_block.go + legacy *_block_test.go (consolidated) - Add block/v0/ subdir + lift_v0.go for old version handling - Copyright header: 'Lux Industries, Inc.' → 'Lux Industries Inc' (no comma) - block_adapter.go: new adapter layer
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package api
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/luxfi/rpc"
|
|
)
|
|
|
|
var _ StaticClient = (*staticClient)(nil)
|
|
|
|
// StaticClient for interacting with the platformvm static api
|
|
type StaticClient interface {
|
|
BuildGenesis(
|
|
ctx context.Context,
|
|
args *BuildGenesisArgs,
|
|
options ...rpc.Option,
|
|
) (*BuildGenesisReply, error)
|
|
}
|
|
|
|
// staticClient is an implementation of a platformvm client for interacting with
|
|
// the platformvm static api
|
|
type staticClient struct {
|
|
requester rpc.EndpointRequester
|
|
}
|
|
|
|
// NewClient returns a platformvm client for interacting with the platformvm static api
|
|
func NewStaticClient(uri string) StaticClient {
|
|
return &staticClient{requester: rpc.NewEndpointRequester(
|
|
uri + "/ext/vm/platform",
|
|
)}
|
|
}
|
|
|
|
func (c *staticClient) BuildGenesis(
|
|
ctx context.Context,
|
|
args *BuildGenesisArgs,
|
|
options ...rpc.Option,
|
|
) (resp *BuildGenesisReply, err error) {
|
|
resp = &BuildGenesisReply{}
|
|
err = c.requester.SendRequest(ctx, "platform.buildGenesis", args, resp, options...)
|
|
return resp, err
|
|
}
|