Skip to content

Commit

Permalink
Merge pull request #41 from cjqpker/main
Browse files Browse the repository at this point in the history
support specified assetId when creating asset
  • Loading branch information
cjqpker authored Nov 18, 2022
2 parents 9854eac + 8691e60 commit 15e2339
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions client/base/asset_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ func CreateAssetInfoValid(p *CreateAssetInfo) error {
}

type CreateAssetParam struct {
AssetId int64 `json:"asset_id"` // optional
Price int64 `json:"price,omitempty"`
Amount int `json:"amount"`
AssetInfo *CreateAssetInfo `json:"asset_info"`
Expand Down
6 changes: 5 additions & 1 deletion client/xasset/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ func (t *AssetOper) UploadFile(param *xbase.UploadFileParam) (*xbase.UploadFileR
// }
func (t *AssetOper) genCreateAssetBody(appid int64, param *xbase.CreateAssetParam) (string, error) {
nonce := utils.GenNonce()
assetId := utils.GenAssetId(appid)
assetId := param.AssetId
// generate assetId if not specified
if assetId == 0 {
assetId = utils.GenAssetId(appid)
}
signMsg := fmt.Sprintf("%d%d", assetId, nonce)
sign, err := auth.XassetSignECDSA(param.Account.PrivateKey, []byte(signMsg))
if err != nil {
Expand Down

0 comments on commit 15e2339

Please sign in to comment.