7 "github.com/bytom/blockchain/asset"
8 "github.com/bytom/crypto/ed25519/chainkd"
9 "github.com/bytom/net/http/httpjson"
10 "github.com/bytom/net/http/reqid"
11 "github.com/bytom/log"
15 func (a *BlockchainReactor) createAsset(ctx context.Context, ins []struct {
17 RootXPubs []chainkd.XPub `json:"root_xpubs"`
19 Definition map[string]interface{}
20 Tags map[string]interface{}
22 // ClientToken is the application's unique token for the asset. Every asset
23 // should have a unique client token. The client token is used to ensure
24 // idempotency of create asset requests. Duplicate create asset requests
25 // with the same client_token will only create one asset.
26 ClientToken string `json:"client_token"`
27 }) ([]interface{}, error) {
28 responses := make([]interface{}, len(ins))
30 wg.Add(len(responses))
32 for i := range responses {
34 subctx := reqid.NewSubContext(ctx, reqid.New())
36 defer batchRecover(subctx, &responses[i])
38 a, err := a.assets.Define(
51 aa, err := asset.Annotated(a)
52 log.Printf(ctx, "-------createAsset-----Annotated asset:%v", aa)
62 log.Printf(ctx, "-------createAsset-----%v", responses)
66 // POST /update-asset-tags
67 func (a *BlockchainReactor) updateAssetTags(ctx context.Context, ins []struct {
70 Tags map[string]interface{} `json:"tags"`
72 log.Printf(ctx,"------updateAssetTags-----")
73 responses := make([]interface{}, len(ins))
75 wg.Add(len(responses))
77 for i := range responses {
79 subctx := reqid.NewSubContext(ctx, reqid.New())
81 defer batchRecover(subctx, &responses[i])
83 err := a.assets.UpdateTags(subctx, ins[i].ID, ins[i].Alias, ins[i].Tags)
87 responses[i] = httpjson.DefaultResponse