github.com/ava-labs/avalanchego@v1.11.11/wallet/chain/p/builder/context.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package builder
     5  
     6  import (
     7  	"github.com/ava-labs/avalanchego/ids"
     8  	"github.com/ava-labs/avalanchego/snow"
     9  	"github.com/ava-labs/avalanchego/utils/constants"
    10  	"github.com/ava-labs/avalanchego/utils/logging"
    11  	"github.com/ava-labs/avalanchego/vms/components/gas"
    12  	"github.com/ava-labs/avalanchego/vms/platformvm/txs/fee"
    13  )
    14  
    15  const Alias = "P"
    16  
    17  type Context struct {
    18  	NetworkID         uint32
    19  	AVAXAssetID       ids.ID
    20  	StaticFeeConfig   fee.StaticConfig
    21  	ComplexityWeights gas.Dimensions
    22  	GasPrice          gas.Price
    23  }
    24  
    25  func NewSnowContext(networkID uint32, avaxAssetID ids.ID) (*snow.Context, error) {
    26  	lookup := ids.NewAliaser()
    27  	return &snow.Context{
    28  		NetworkID:   networkID,
    29  		SubnetID:    constants.PrimaryNetworkID,
    30  		ChainID:     constants.PlatformChainID,
    31  		AVAXAssetID: avaxAssetID,
    32  		Log:         logging.NoLog{},
    33  		BCLookup:    lookup,
    34  	}, lookup.Alias(constants.PlatformChainID, Alias)
    35  }