@@ -10,6 +10,7 @@ import {
1010 ApiTags ,
1111 ApiUnprocessableEntityResponse ,
1212} from '@nestjs/swagger' ;
13+ import { Asset } from '@polymeshassociation/polymesh-sdk/types' ;
1314
1415import { AssetsService } from '~/assets/assets.service' ;
1516import { createAssetDetailsModel } from '~/assets/assets.util' ;
@@ -23,6 +24,7 @@ import { SetAssetDocumentsDto } from '~/assets/dto/set-asset-documents.dto';
2324import { AgentOperationModel } from '~/assets/models/agent-operation.model' ;
2425import { AssetDetailsModel } from '~/assets/models/asset-details.model' ;
2526import { AssetDocumentModel } from '~/assets/models/asset-document.model' ;
27+ import { CreatedAssetModel } from '~/assets/models/created-asset.model' ;
2628import { IdentityBalanceModel } from '~/assets/models/identity-balance.model' ;
2729import { RequiredMediatorsModel } from '~/assets/models/required-mediators.model' ;
2830import { authorizationRequestResolver } from '~/authorizations/authorizations.util' ;
@@ -33,7 +35,7 @@ import { TransactionBaseDto } from '~/common/dto/transaction-base-dto';
3335import { TransferOwnershipDto } from '~/common/dto/transfer-ownership.dto' ;
3436import { PaginatedResultsModel } from '~/common/models/paginated-results.model' ;
3537import { TransactionQueueModel } from '~/common/models/transaction-queue.model' ;
36- import { handleServiceResult , TransactionResponseModel } from '~/common/utils' ;
38+ import { handleServiceResult , TransactionResolver , TransactionResponseModel } from '~/common/utils' ;
3739import { MetadataService } from '~/metadata/metadata.service' ;
3840import { GlobalMetadataModel } from '~/metadata/models/global-metadata.model' ;
3941
@@ -72,7 +74,7 @@ export class AssetsController {
7274 name : 'asset' ,
7375 description : 'The Asset (Ticker/Asset ID) whose details are to be fetched' ,
7476 type : 'string' ,
75- example : '0xa3616b82e8e1080aedc952ea28b9db8b ' ,
77+ example : '3616b82e-8e10-80ae-dc95-2ea28b9db8b3 ' ,
7678 } )
7779 @ApiOkResponse ( {
7880 description : 'Basic details of the Asset' ,
@@ -94,7 +96,7 @@ export class AssetsController {
9496 name : 'asset' ,
9597 description : 'The Asset (Ticker/Asset ID) whose holders are to be fetched' ,
9698 type : 'string' ,
97- example : '0xa3616b82e8e1080aedc952ea28b9db8b ' ,
99+ example : '3616b82e-8e10-80ae-dc95-2ea28b9db8b3 ' ,
98100 } )
99101 @ApiQuery ( {
100102 name : 'size' ,
@@ -146,7 +148,7 @@ export class AssetsController {
146148 name : 'asset' ,
147149 description : 'The Asset (Ticker/Asset ID) whose attached documents are to be fetched' ,
148150 type : 'string' ,
149- example : '0xa3616b82e8e1080aedc952ea28b9db8b ' ,
151+ example : '3616b82e-8e10-80ae-dc95-2ea28b9db8b3 ' ,
150152 } )
151153 @ApiQuery ( {
152154 name : 'size' ,
@@ -203,7 +205,7 @@ export class AssetsController {
203205 name : 'asset' ,
204206 description : 'The Asset (Ticker/Asset ID) whose documents are to be updated' ,
205207 type : 'string' ,
206- example : '0xa3616b82e8e1080aedc952ea28b9db8b ' ,
208+ example : '3616b82e-8e10-80ae-dc95-2ea28b9db8b3 ' ,
207209 } )
208210 @ApiOkResponse ( {
209211 description : 'Details of the transaction' ,
@@ -231,7 +233,7 @@ export class AssetsController {
231233 name : 'asset' ,
232234 description : 'The Asset (Ticker/Asset ID) to issue' ,
233235 type : 'string' ,
234- example : '0xa3616b82e8e1080aedc952ea28b9db8b ' ,
236+ example : '3616b82e-8e10-80ae-dc95-2ea28b9db8b3 ' ,
235237 } )
236238 @ApiTransactionResponse ( {
237239 description : 'Details about the transaction' ,
@@ -266,7 +268,15 @@ export class AssetsController {
266268 @Post ( 'create' )
267269 public async createAsset ( @Body ( ) params : CreateAssetDto ) : Promise < TransactionResponseModel > {
268270 const result = await this . assetsService . createAsset ( params ) ;
269- return handleServiceResult ( result ) ;
271+
272+ const resolver : TransactionResolver < Asset > = ( { result : asset , transactions, details } ) =>
273+ new CreatedAssetModel ( {
274+ asset,
275+ transactions,
276+ details,
277+ } ) ;
278+
279+ return handleServiceResult ( result , resolver ) ;
270280 }
271281
272282 @ApiOperation ( {
@@ -278,7 +288,7 @@ export class AssetsController {
278288 name : 'asset' ,
279289 description : 'The Asset (Ticker/Asset ID) whose ownership is to be transferred' ,
280290 type : 'string' ,
281- example : '0xa3616b82e8e1080aedc952ea28b9db8b ' ,
291+ example : '3616b82e-8e10-80ae-dc95-2ea28b9db8b3 ' ,
282292 } )
283293 @ApiTransactionResponse ( {
284294 description : 'Newly created Authorization Request along with transaction details' ,
@@ -329,7 +339,7 @@ export class AssetsController {
329339 name : 'asset' ,
330340 description : 'The Asset (Ticker/Asset ID) to freeze' ,
331341 type : 'string' ,
332- example : '0xa3616b82e8e1080aedc952ea28b9db8b ' ,
342+ example : '3616b82e-8e10-80ae-dc95-2ea28b9db8b3 ' ,
333343 } )
334344 @ApiTransactionResponse ( {
335345 description : 'Details about the transaction' ,
@@ -360,7 +370,7 @@ export class AssetsController {
360370 name : 'asset' ,
361371 description : 'The Asset (Ticker/Asset ID) to unfreeze' ,
362372 type : 'string' ,
363- example : '0xa3616b82e8e1080aedc952ea28b9db8b ' ,
373+ example : '3616b82e-8e10-80ae-dc95-2ea28b9db8b3 ' ,
364374 } )
365375 @ApiTransactionResponse ( {
366376 description : 'Details about the transaction' ,
@@ -390,7 +400,7 @@ export class AssetsController {
390400 name : 'asset' ,
391401 description : 'The Asset (Ticker/Asset ID) to be transferred' ,
392402 type : 'string' ,
393- example : '0xa3616b82e8e1080aedc952ea28b9db8b ' ,
403+ example : '3616b82e-8e10-80ae-dc95-2ea28b9db8b3 ' ,
394404 } )
395405 @ApiTransactionResponse ( {
396406 description : 'Details about the transaction' ,
@@ -420,7 +430,7 @@ export class AssetsController {
420430 name : 'asset' ,
421431 description : 'The Asset (Ticker/Asset ID) whose operation history is to be fetched' ,
422432 type : 'string' ,
423- example : '0xa3616b82e8e1080aedc952ea28b9db8b ' ,
433+ example : '3616b82e-8e10-80ae-dc95-2ea28b9db8b3 ' ,
424434 } )
425435 @ApiOkResponse ( {
426436 description : 'List of operations grouped by the agent Identity who performed them' ,
@@ -445,7 +455,7 @@ export class AssetsController {
445455 name : 'asset' ,
446456 description : 'The Asset (Ticker/Asset ID) whose required mediators is to be fetched' ,
447457 type : 'string' ,
448- example : '0xa3616b82e8e1080aedc952ea28b9db8b ' ,
458+ example : '3616b82e-8e10-80ae-dc95-2ea28b9db8b3 ' ,
449459 } )
450460 @ApiOkResponse ( {
451461 description : 'The required mediators for the asset' ,
@@ -470,7 +480,7 @@ export class AssetsController {
470480 name : 'asset' ,
471481 description : 'The Asset (Ticker/Asset ID) to set required mediators for' ,
472482 type : 'string' ,
473- example : '0xa3616b82e8e1080aedc952ea28b9db8b ' ,
483+ example : '3616b82e-8e10-80ae-dc95-2ea28b9db8b3 ' ,
474484 } )
475485 @ApiTransactionResponse ( {
476486 description : 'Details about the transaction' ,
@@ -496,7 +506,7 @@ export class AssetsController {
496506 name : 'asset' ,
497507 description : 'The Asset (Ticker/Asset ID) to set required mediators for' ,
498508 type : 'string' ,
499- example : '0xa3616b82e8e1080aedc952ea28b9db8b ' ,
509+ example : '3616b82e-8e10-80ae-dc95-2ea28b9db8b3 ' ,
500510 } )
501511 @ApiTransactionResponse ( {
502512 description : 'Details about the transaction' ,
@@ -522,7 +532,7 @@ export class AssetsController {
522532 name : 'asset' ,
523533 description : 'The Asset (Ticker/Asset ID) to pre-approve' ,
524534 type : 'string' ,
525- example : '0xa3616b82e8e1080aedc952ea28b9db8b ' ,
535+ example : '3616b82e-8e10-80ae-dc95-2ea28b9db8b3 ' ,
526536 } )
527537 @ApiTransactionResponse ( {
528538 description : 'Details about the transaction' ,
@@ -552,7 +562,7 @@ export class AssetsController {
552562 name : 'asset' ,
553563 description : 'The Asset (Ticker/Asset ID) to remove pre-approval for' ,
554564 type : 'string' ,
555- example : '0xa3616b82e8e1080aedc952ea28b9db8b ' ,
565+ example : '3616b82e-8e10-80ae-dc95-2ea28b9db8b3 ' ,
556566 } )
557567 @ApiTransactionResponse ( {
558568 description : 'Details about the transaction' ,
0 commit comments