github.com/ava-labs/avalanchego@v1.11.11/wallet/chain/x/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  )
    12  
    13  const Alias = "X"
    14  
    15  type Context struct {
    16  	NetworkID        uint32
    17  	BlockchainID     ids.ID
    18  	AVAXAssetID      ids.ID
    19  	BaseTxFee        uint64
    20  	CreateAssetTxFee uint64
    21  }
    22  
    23  func NewSnowContext(
    24  	networkID uint32,
    25  	blockchainID ids.ID,
    26  	avaxAssetID ids.ID,
    27  ) (*snow.Context, error) {
    28  	lookup := ids.NewAliaser()
    29  	return &snow.Context{
    30  		NetworkID:   networkID,
    31  		SubnetID:    constants.PrimaryNetworkID,
    32  		ChainID:     blockchainID,
    33  		XChainID:    blockchainID,
    34  		AVAXAssetID: avaxAssetID,
    35  		Log:         logging.NoLog{},
    36  		BCLookup:    lookup,
    37  	}, lookup.Alias(blockchainID, Alias)
    38  }