@@ -866,7 +866,9 @@ func TestServiceGetTxJSON_OperationTxWithNftxMintOp(t *testing.T) {
866
866
require := require .New (t )
867
867
868
868
env := setup (t , & envConfig {
869
- vmStaticConfig : & config.Config {},
869
+ vmStaticConfig : & config.Config {
870
+ DurangoTime : time.Time {},
871
+ },
870
872
additionalFxs : []* common.Fx {{
871
873
ID : propertyfx .ID ,
872
874
Fx : & propertyfx.Fx {},
@@ -883,7 +885,8 @@ func TestServiceGetTxJSON_OperationTxWithNftxMintOp(t *testing.T) {
883
885
createAssetTx := newAvaxCreateAssetTxWithOutputs (t , env )
884
886
issueAndAccept (require , env .vm , env .issuer , createAssetTx )
885
887
886
- mintNFTTx := buildOperationTxWithOp (env .vm .ctx .ChainID , buildNFTxMintOp (createAssetTx , key , 2 , 1 ))
888
+ op := buildNFTxMintOp (createAssetTx , key , 2 , 1 )
889
+ mintNFTTx := buildOperationTxWithOp (t , env , []* txs.Operation {op }, nil )
887
890
require .NoError (mintNFTTx .SignNFTFx (env .vm .parser .Codec (), [][]* secp256k1.PrivateKey {{key }}))
888
891
issueAndAccept (require , env .vm , env .issuer , mintNFTTx )
889
892
@@ -965,7 +968,9 @@ func TestServiceGetTxJSON_OperationTxWithMultipleNftxMintOp(t *testing.T) {
965
968
require := require .New (t )
966
969
967
970
env := setup (t , & envConfig {
968
- vmStaticConfig : & config.Config {},
971
+ vmStaticConfig : & config.Config {
972
+ DurangoTime : time.Time {},
973
+ },
969
974
additionalFxs : []* common.Fx {{
970
975
ID : propertyfx .ID ,
971
976
Fx : & propertyfx.Fx {},
@@ -984,8 +989,7 @@ func TestServiceGetTxJSON_OperationTxWithMultipleNftxMintOp(t *testing.T) {
984
989
985
990
mintOp1 := buildNFTxMintOp (createAssetTx , key , 2 , 1 )
986
991
mintOp2 := buildNFTxMintOp (createAssetTx , key , 3 , 2 )
987
- mintNFTTx := buildOperationTxWithOp (env .vm .ctx .ChainID , mintOp1 , mintOp2 )
988
-
992
+ mintNFTTx := buildOperationTxWithOp (t , env , []* txs.Operation {mintOp1 , mintOp2 }, nil )
989
993
require .NoError (mintNFTTx .SignNFTFx (env .vm .parser .Codec (), [][]* secp256k1.PrivateKey {{key }, {key }}))
990
994
issueAndAccept (require , env .vm , env .issuer , mintNFTTx )
991
995
@@ -1103,7 +1107,9 @@ func TestServiceGetTxJSON_OperationTxWithSecpMintOp(t *testing.T) {
1103
1107
require := require .New (t )
1104
1108
1105
1109
env := setup (t , & envConfig {
1106
- vmStaticConfig : & config.Config {},
1110
+ vmStaticConfig : & config.Config {
1111
+ DurangoTime : time.Time {},
1112
+ },
1107
1113
additionalFxs : []* common.Fx {{
1108
1114
ID : propertyfx .ID ,
1109
1115
Fx : & propertyfx.Fx {},
@@ -1120,8 +1126,8 @@ func TestServiceGetTxJSON_OperationTxWithSecpMintOp(t *testing.T) {
1120
1126
createAssetTx := newAvaxCreateAssetTxWithOutputs (t , env )
1121
1127
issueAndAccept (require , env .vm , env .issuer , createAssetTx )
1122
1128
1123
- mintSecpOpTx := buildOperationTxWithOp ( env . vm . ctx . ChainID , buildSecpMintOp (createAssetTx , key , 0 ) )
1124
- require . NoError ( mintSecpOpTx . SignSECP256K1Fx ( env . vm . parser . Codec () , [][]* secp256k1.PrivateKey {{key }}) )
1129
+ op := buildSecpMintOp (createAssetTx , key , 0 )
1130
+ mintSecpOpTx := buildOperationTxWithOp ( t , env , [] * txs. Operation { op } , [][]* secp256k1.PrivateKey {{key }})
1125
1131
issueAndAccept (require , env .vm , env .issuer , mintSecpOpTx )
1126
1132
1127
1133
reply := api.GetTxReply {}
@@ -1206,7 +1212,9 @@ func TestServiceGetTxJSON_OperationTxWithMultipleSecpMintOp(t *testing.T) {
1206
1212
require := require .New (t )
1207
1213
1208
1214
env := setup (t , & envConfig {
1209
- vmStaticConfig : & config.Config {},
1215
+ vmStaticConfig : & config.Config {
1216
+ DurangoTime : time.Time {},
1217
+ },
1210
1218
additionalFxs : []* common.Fx {{
1211
1219
ID : propertyfx .ID ,
1212
1220
Fx : & propertyfx.Fx {},
@@ -1225,9 +1233,7 @@ func TestServiceGetTxJSON_OperationTxWithMultipleSecpMintOp(t *testing.T) {
1225
1233
1226
1234
op1 := buildSecpMintOp (createAssetTx , key , 0 )
1227
1235
op2 := buildSecpMintOp (createAssetTx , key , 1 )
1228
- mintSecpOpTx := buildOperationTxWithOp (env .vm .ctx .ChainID , op1 , op2 )
1229
-
1230
- require .NoError (mintSecpOpTx .SignSECP256K1Fx (env .vm .parser .Codec (), [][]* secp256k1.PrivateKey {{key }, {key }}))
1236
+ mintSecpOpTx := buildOperationTxWithOp (t , env , []* txs.Operation {op1 , op2 }, [][]* secp256k1.PrivateKey {{key }, {key }})
1231
1237
issueAndAccept (require , env .vm , env .issuer , mintSecpOpTx )
1232
1238
1233
1239
reply := api.GetTxReply {}
@@ -1352,7 +1358,9 @@ func TestServiceGetTxJSON_OperationTxWithPropertyFxMintOp(t *testing.T) {
1352
1358
require := require .New (t )
1353
1359
1354
1360
env := setup (t , & envConfig {
1355
- vmStaticConfig : & config.Config {},
1361
+ vmStaticConfig : & config.Config {
1362
+ DurangoTime : time.Time {},
1363
+ },
1356
1364
additionalFxs : []* common.Fx {{
1357
1365
ID : propertyfx .ID ,
1358
1366
Fx : & propertyfx.Fx {},
@@ -1369,7 +1377,8 @@ func TestServiceGetTxJSON_OperationTxWithPropertyFxMintOp(t *testing.T) {
1369
1377
createAssetTx := newAvaxCreateAssetTxWithOutputs (t , env )
1370
1378
issueAndAccept (require , env .vm , env .issuer , createAssetTx )
1371
1379
1372
- mintPropertyFxOpTx := buildOperationTxWithOp (env .vm .ctx .ChainID , buildPropertyFxMintOp (createAssetTx , key , 4 ))
1380
+ op := buildPropertyFxMintOp (createAssetTx , key , 4 )
1381
+ mintPropertyFxOpTx := buildOperationTxWithOp (t , env , []* txs.Operation {op }, nil )
1373
1382
require .NoError (mintPropertyFxOpTx .SignPropertyFx (env .vm .parser .Codec (), [][]* secp256k1.PrivateKey {{key }}))
1374
1383
issueAndAccept (require , env .vm , env .issuer , mintPropertyFxOpTx )
1375
1384
@@ -1452,7 +1461,9 @@ func TestServiceGetTxJSON_OperationTxWithPropertyFxMintOpMultiple(t *testing.T)
1452
1461
require := require .New (t )
1453
1462
1454
1463
env := setup (t , & envConfig {
1455
- vmStaticConfig : & config.Config {},
1464
+ vmStaticConfig : & config.Config {
1465
+ DurangoTime : time.Time {},
1466
+ },
1456
1467
additionalFxs : []* common.Fx {{
1457
1468
ID : propertyfx .ID ,
1458
1469
Fx : & propertyfx.Fx {},
@@ -1471,8 +1482,7 @@ func TestServiceGetTxJSON_OperationTxWithPropertyFxMintOpMultiple(t *testing.T)
1471
1482
1472
1483
op1 := buildPropertyFxMintOp (createAssetTx , key , 4 )
1473
1484
op2 := buildPropertyFxMintOp (createAssetTx , key , 5 )
1474
- mintPropertyFxOpTx := buildOperationTxWithOp (env .vm .ctx .ChainID , op1 , op2 )
1475
-
1485
+ mintPropertyFxOpTx := buildOperationTxWithOp (t , env , []* txs.Operation {op1 , op2 }, nil )
1476
1486
require .NoError (mintPropertyFxOpTx .SignPropertyFx (env .vm .parser .Codec (), [][]* secp256k1.PrivateKey {{key }, {key }}))
1477
1487
issueAndAccept (require , env .vm , env .issuer , mintPropertyFxOpTx )
1478
1488
@@ -1809,14 +1819,25 @@ func buildSecpMintOp(createAssetTx *txs.Tx, key *secp256k1.PrivateKey, outputInd
1809
1819
}
1810
1820
}
1811
1821
1812
- func buildOperationTxWithOp (chainID ids.ID , op ... * txs.Operation ) * txs.Tx {
1813
- return & txs.Tx {Unsigned : & txs.OperationTx {
1814
- BaseTx : txs.BaseTx {BaseTx : avax.BaseTx {
1815
- NetworkID : constants .UnitTestID ,
1816
- BlockchainID : chainID ,
1817
- }},
1818
- Ops : op ,
1819
- }}
1822
+ func buildOperationTxWithOp (t * testing.T , env * environment , ops []* txs.Operation , opsKeys [][]* secp256k1.PrivateKey ) * txs.Tx {
1823
+ var (
1824
+ key = keys [0 ]
1825
+ kc = secp256k1fx .NewKeychain ()
1826
+ )
1827
+ kc .Add (key )
1828
+ utxos , err := avax .GetAllUTXOs (env .vm .state , kc .Addresses ())
1829
+ require .NoError (t , err )
1830
+
1831
+ tx , _ , err := buildOperation (
1832
+ env .vm ,
1833
+ ops ,
1834
+ opsKeys ,
1835
+ utxos ,
1836
+ kc ,
1837
+ key .Address (),
1838
+ )
1839
+ require .NoError (t , err )
1840
+ return tx
1820
1841
}
1821
1842
1822
1843
func TestServiceGetNilTx (t * testing.T ) {
0 commit comments