github.com/ava-labs/avalanchego@v1.11.11/vms/rpcchainvm/gruntime/runtime_client.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package gruntime 5 6 import ( 7 "context" 8 9 "github.com/ava-labs/avalanchego/vms/rpcchainvm/runtime" 10 11 pb "github.com/ava-labs/avalanchego/proto/pb/vm/runtime" 12 ) 13 14 var _ runtime.Initializer = (*Client)(nil) 15 16 // Client is a VM runtime initializer. 17 type Client struct { 18 client pb.RuntimeClient 19 } 20 21 func NewClient(client pb.RuntimeClient) *Client { 22 return &Client{client: client} 23 } 24 25 func (c *Client) Initialize(ctx context.Context, protocolVersion uint, vmAddr string) error { 26 _, err := c.client.Initialize(ctx, &pb.InitializeRequest{ 27 ProtocolVersion: uint32(protocolVersion), 28 Addr: vmAddr, 29 }) 30 return err 31 }