@@ -699,7 +699,10 @@ func TestServiceGetTxJSON_CreateAssetTx(t *testing.T) {
699
699
require := require .New (t )
700
700
701
701
env := setup (t , & envConfig {
702
- vmStaticConfig : & config.Config {},
702
+ vmStaticConfig : & config.Config {
703
+ CreateAssetTxFee : testTxFee ,
704
+ DurangoTime : time.Time {},
705
+ },
703
706
additionalFxs : []* common.Fx {{
704
707
ID : propertyfx .ID ,
705
708
Fx : & propertyfx.Fx {},
@@ -712,7 +715,7 @@ func TestServiceGetTxJSON_CreateAssetTx(t *testing.T) {
712
715
env .vm .ctx .Lock .Unlock ()
713
716
}()
714
717
715
- createAssetTx := newAvaxCreateAssetTxWithOutputs (t , env . vm . ctx . ChainID , env . vm . parser )
718
+ createAssetTx := newAvaxCreateAssetTxWithOutputs (t , env )
716
719
issueAndAccept (require , env .vm , env .issuer , createAssetTx )
717
720
718
721
reply := api.GetTxReply {}
@@ -730,8 +733,34 @@ func TestServiceGetTxJSON_CreateAssetTx(t *testing.T) {
730
733
"unsignedTx": {
731
734
"networkID": 10,
732
735
"blockchainID": "PLACEHOLDER_BLOCKCHAIN_ID",
733
- "outputs": null,
734
- "inputs": null,
736
+ "outputs": [
737
+ {
738
+ "assetID": "2XGxUr7VF7j1iwUp2aiGe4b6Ue2yyNghNS1SuNTNmZ77dPpXFZ",
739
+ "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ",
740
+ "output": {
741
+ "addresses": [
742
+ "X-testing1lnk637g0edwnqc2tn8tel39652fswa3xk4r65e"
743
+ ],
744
+ "amount": 49000,
745
+ "locktime": 0,
746
+ "threshold": 1
747
+ }
748
+ }
749
+ ],
750
+ "inputs": [
751
+ {
752
+ "txID": "2XGxUr7VF7j1iwUp2aiGe4b6Ue2yyNghNS1SuNTNmZ77dPpXFZ",
753
+ "outputIndex": 2,
754
+ "assetID": "2XGxUr7VF7j1iwUp2aiGe4b6Ue2yyNghNS1SuNTNmZ77dPpXFZ",
755
+ "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ",
756
+ "input": {
757
+ "amount": 50000,
758
+ "signatureIndices": [
759
+ 0
760
+ ]
761
+ }
762
+ }
763
+ ],
735
764
"memo": "0x",
736
765
"name": "Team Rocket",
737
766
"symbol": "TR",
@@ -801,7 +830,16 @@ func TestServiceGetTxJSON_CreateAssetTx(t *testing.T) {
801
830
}
802
831
]
803
832
},
804
- "credentials": null,
833
+ "credentials": [
834
+ {
835
+ "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ",
836
+ "credential": {
837
+ "signatures": [
838
+ "0xa036832b708b377ef9719ffbc834a3fb933191a467994f844c23f4a44350e86a7151cdbbbfa479d93a4906cc22254dcc5ccc2a6099492e7a9f9e8b575048d69701"
839
+ ]
840
+ }
841
+ }
842
+ ],
805
843
"id": "PLACEHOLDER_TX_ID"
806
844
}`
807
845
@@ -829,7 +867,7 @@ func TestServiceGetTxJSON_OperationTxWithNftxMintOp(t *testing.T) {
829
867
}()
830
868
831
869
key := keys [0 ]
832
- createAssetTx := newAvaxCreateAssetTxWithOutputs (t , env . vm . ctx . ChainID , env . vm . parser )
870
+ createAssetTx := newAvaxCreateAssetTxWithOutputs (t , env )
833
871
issueAndAccept (require , env .vm , env .issuer , createAssetTx )
834
872
835
873
mintNFTTx := buildOperationTxWithOp (env .vm .ctx .ChainID , buildNFTxMintOp (createAssetTx , key , 2 , 1 ))
@@ -928,7 +966,7 @@ func TestServiceGetTxJSON_OperationTxWithMultipleNftxMintOp(t *testing.T) {
928
966
}()
929
967
930
968
key := keys [0 ]
931
- createAssetTx := newAvaxCreateAssetTxWithOutputs (t , env . vm . ctx . ChainID , env . vm . parser )
969
+ createAssetTx := newAvaxCreateAssetTxWithOutputs (t , env )
932
970
issueAndAccept (require , env .vm , env .issuer , createAssetTx )
933
971
934
972
mintOp1 := buildNFTxMintOp (createAssetTx , key , 2 , 1 )
@@ -1066,7 +1104,7 @@ func TestServiceGetTxJSON_OperationTxWithSecpMintOp(t *testing.T) {
1066
1104
}()
1067
1105
1068
1106
key := keys [0 ]
1069
- createAssetTx := newAvaxCreateAssetTxWithOutputs (t , env . vm . ctx . ChainID , env . vm . parser )
1107
+ createAssetTx := newAvaxCreateAssetTxWithOutputs (t , env )
1070
1108
issueAndAccept (require , env .vm , env .issuer , createAssetTx )
1071
1109
1072
1110
mintSecpOpTx := buildOperationTxWithOp (env .vm .ctx .ChainID , buildSecpMintOp (createAssetTx , key , 0 ))
@@ -1169,7 +1207,7 @@ func TestServiceGetTxJSON_OperationTxWithMultipleSecpMintOp(t *testing.T) {
1169
1207
}()
1170
1208
1171
1209
key := keys [0 ]
1172
- createAssetTx := newAvaxCreateAssetTxWithOutputs (t , env . vm . ctx . ChainID , env . vm . parser )
1210
+ createAssetTx := newAvaxCreateAssetTxWithOutputs (t , env )
1173
1211
issueAndAccept (require , env .vm , env .issuer , createAssetTx )
1174
1212
1175
1213
op1 := buildSecpMintOp (createAssetTx , key , 0 )
@@ -1315,7 +1353,7 @@ func TestServiceGetTxJSON_OperationTxWithPropertyFxMintOp(t *testing.T) {
1315
1353
}()
1316
1354
1317
1355
key := keys [0 ]
1318
- createAssetTx := newAvaxCreateAssetTxWithOutputs (t , env . vm . ctx . ChainID , env . vm . parser )
1356
+ createAssetTx := newAvaxCreateAssetTxWithOutputs (t , env )
1319
1357
issueAndAccept (require , env .vm , env .issuer , createAssetTx )
1320
1358
1321
1359
mintPropertyFxOpTx := buildOperationTxWithOp (env .vm .ctx .ChainID , buildPropertyFxMintOp (createAssetTx , key , 4 ))
@@ -1415,7 +1453,7 @@ func TestServiceGetTxJSON_OperationTxWithPropertyFxMintOpMultiple(t *testing.T)
1415
1453
}()
1416
1454
1417
1455
key := keys [0 ]
1418
- createAssetTx := newAvaxCreateAssetTxWithOutputs (t , env . vm . ctx . ChainID , env . vm . parser )
1456
+ createAssetTx := newAvaxCreateAssetTxWithOutputs (t , env )
1419
1457
issueAndAccept (require , env .vm , env .issuer , createAssetTx )
1420
1458
1421
1459
op1 := buildPropertyFxMintOp (createAssetTx , key , 4 )
@@ -1553,10 +1591,78 @@ func newAvaxExportTxWithOutputs(t *testing.T, genesisBytes []byte, chainID ids.I
1553
1591
return tx
1554
1592
}
1555
1593
1556
- func newAvaxCreateAssetTxWithOutputs (t * testing.T , chainID ids.ID , parser txs.Parser ) * txs.Tx {
1557
- key := keys [0 ]
1558
- tx := buildCreateAssetTx (chainID , key )
1559
- require .NoError (t , tx .Initialize (parser .Codec ()))
1594
+ func newAvaxCreateAssetTxWithOutputs (t * testing.T , env * environment ) * txs.Tx {
1595
+ var (
1596
+ key = keys [0 ]
1597
+ kc = secp256k1fx .NewKeychain ()
1598
+ )
1599
+ kc .Add (key )
1600
+ utxos , err := avax .GetAllUTXOs (env .vm .state , kc .Addresses ())
1601
+ require .NoError (t , err )
1602
+ tx , _ , err := buildCreateAssetTx (
1603
+ env .vm ,
1604
+ "Team Rocket" , // name
1605
+ "TR" , // symbol
1606
+ 0 , // denomination
1607
+ []* txs.InitialState {
1608
+ {
1609
+ FxIndex : 0 ,
1610
+ Outs : []verify.State {
1611
+ & secp256k1fx.MintOutput {
1612
+ OutputOwners : secp256k1fx.OutputOwners {
1613
+ Threshold : 1 ,
1614
+ Addrs : []ids.ShortID {key .PublicKey ().Address ()},
1615
+ },
1616
+ }, & secp256k1fx.MintOutput {
1617
+ OutputOwners : secp256k1fx.OutputOwners {
1618
+ Threshold : 1 ,
1619
+ Addrs : []ids.ShortID {key .PublicKey ().Address ()},
1620
+ },
1621
+ },
1622
+ },
1623
+ },
1624
+ {
1625
+ FxIndex : 1 ,
1626
+ Outs : []verify.State {
1627
+ & nftfx.MintOutput {
1628
+ GroupID : 1 ,
1629
+ OutputOwners : secp256k1fx.OutputOwners {
1630
+ Threshold : 1 ,
1631
+ Addrs : []ids.ShortID {key .PublicKey ().Address ()},
1632
+ },
1633
+ },
1634
+ & nftfx.MintOutput {
1635
+ GroupID : 2 ,
1636
+ OutputOwners : secp256k1fx.OutputOwners {
1637
+ Threshold : 1 ,
1638
+ Addrs : []ids.ShortID {key .PublicKey ().Address ()},
1639
+ },
1640
+ },
1641
+ },
1642
+ },
1643
+ {
1644
+ FxIndex : 2 ,
1645
+ Outs : []verify.State {
1646
+ & propertyfx.MintOutput {
1647
+ OutputOwners : secp256k1fx.OutputOwners {
1648
+ Threshold : 1 ,
1649
+ Addrs : []ids.ShortID {keys [0 ].PublicKey ().Address ()},
1650
+ },
1651
+ },
1652
+ & propertyfx.MintOutput {
1653
+ OutputOwners : secp256k1fx.OutputOwners {
1654
+ Threshold : 1 ,
1655
+ Addrs : []ids.ShortID {keys [0 ].PublicKey ().Address ()},
1656
+ },
1657
+ },
1658
+ },
1659
+ },
1660
+ },
1661
+ utxos ,
1662
+ kc ,
1663
+ key .Address (),
1664
+ )
1665
+ require .NoError (t , err )
1560
1666
return tx
1561
1667
}
1562
1668
@@ -1628,7 +1734,7 @@ func buildExportTx(avaxTx *txs.Tx, chainID ids.ID, fee uint64, key *secp256k1.Pr
1628
1734
}}
1629
1735
}
1630
1736
1631
- func buildCreateAssetTx (chainID ids.ID , key * secp256k1.PrivateKey ) * txs.Tx {
1737
+ func buildTestCreateAssetTx (chainID ids.ID , key * secp256k1.PrivateKey ) * txs.Tx {
1632
1738
return & txs.Tx {Unsigned : & txs.CreateAssetTx {
1633
1739
BaseTx : txs.BaseTx {BaseTx : avax.BaseTx {
1634
1740
NetworkID : constants .UnitTestID ,
0 commit comments