7
7
"context"
8
8
9
9
"github.com/ava-labs/avalanchego/api/info"
10
- "github.com/ava-labs/avalanchego/vms/avm "
10
+ "github.com/ava-labs/avalanchego/utils/constants "
11
11
"github.com/ava-labs/avalanchego/vms/platformvm"
12
12
"github.com/ava-labs/avalanchego/vms/platformvm/txs/fee"
13
13
"github.com/ava-labs/avalanchego/wallet/chain/p/builder"
@@ -21,42 +21,40 @@ const gasPriceMultiplier = 2
21
21
22
22
func NewContextFromURI (ctx context.Context , uri string ) (* builder.Context , error ) {
23
23
infoClient := info .NewClient (uri )
24
- xChainClient := avm .NewClient (uri , "X" )
25
- pChainClient := platformvm .NewClient (uri )
26
- return NewContextFromClients (ctx , infoClient , xChainClient , pChainClient )
24
+ chainClient := platformvm .NewClient (uri )
25
+ return NewContextFromClients (ctx , infoClient , chainClient )
27
26
}
28
27
29
28
func NewContextFromClients (
30
29
ctx context.Context ,
31
30
infoClient info.Client ,
32
- xChainClient avm.Client ,
33
- pChainClient platformvm.Client ,
31
+ chainClient platformvm.Client ,
34
32
) (* builder.Context , error ) {
35
33
networkID , err := infoClient .GetNetworkID (ctx )
36
34
if err != nil {
37
35
return nil , err
38
36
}
39
37
40
- asset , err := xChainClient . GetAssetDescription (ctx , "AVAX" )
38
+ avaxAssetID , err := chainClient . GetStakingAssetID (ctx , constants . PrimaryNetworkID )
41
39
if err != nil {
42
40
return nil , err
43
41
}
44
42
45
- dynamicFeeConfig , err := pChainClient .GetFeeConfig (ctx )
43
+ dynamicFeeConfig , err := chainClient .GetFeeConfig (ctx )
46
44
if err != nil {
47
45
return nil , err
48
46
}
49
47
50
48
// TODO: After Etna is activated, assume the gas price is always non-zero.
51
49
if dynamicFeeConfig .MinPrice != 0 {
52
- _ , gasPrice , _ , err := pChainClient .GetFeeState (ctx )
50
+ _ , gasPrice , _ , err := chainClient .GetFeeState (ctx )
53
51
if err != nil {
54
52
return nil , err
55
53
}
56
54
57
55
return & builder.Context {
58
56
NetworkID : networkID ,
59
- AVAXAssetID : asset . AssetID ,
57
+ AVAXAssetID : avaxAssetID ,
60
58
ComplexityWeights : dynamicFeeConfig .Weights ,
61
59
GasPrice : gasPriceMultiplier * gasPrice ,
62
60
}, nil
@@ -69,7 +67,7 @@ func NewContextFromClients(
69
67
70
68
return & builder.Context {
71
69
NetworkID : networkID ,
72
- AVAXAssetID : asset . AssetID ,
70
+ AVAXAssetID : avaxAssetID ,
73
71
StaticFeeConfig : fee.StaticConfig {
74
72
TxFee : uint64 (staticFeeConfig .TxFee ),
75
73
CreateSubnetTxFee : uint64 (staticFeeConfig .CreateSubnetTxFee ),
0 commit comments