diff --git a/src/tokens/tokens.interfaces.ts b/src/tokens/tokens.interfaces.ts index 4bd5572..7db1c81 100644 --- a/src/tokens/tokens.interfaces.ts +++ b/src/tokens/tokens.interfaces.ts @@ -81,6 +81,8 @@ const requestIdDescription = 'If none is provided, one will be assigned and returned in the 202 response.'; const poolConfigDescription = 'Optional configuration info for the token pool. Reserved for future use.'; +const approvalConfigDescription = + 'Optional configuration info for the token approval. Reserved for future use.'; export class TokenPool { @ApiProperty({ enum: TokenType }) @@ -111,7 +113,7 @@ export class TokenApproval { @ApiProperty() @IsNotEmpty() - owner: string; + signer: string; @ApiProperty() @IsNotEmpty() @@ -128,6 +130,10 @@ export class TokenApproval { @ApiProperty() @IsOptional() data?: string; + + @ApiProperty({ description: approvalConfigDescription }) + @IsOptional() + config?: any; } export class BlockchainTransaction { diff --git a/src/tokens/tokens.service.ts b/src/tokens/tokens.service.ts index 4201645..9466407 100644 --- a/src/tokens/tokens.service.ts +++ b/src/tokens/tokens.service.ts @@ -240,6 +240,8 @@ export class TokensService { this.stream.id, approvalForAllEvent, packSubscriptionName(this.topic, dto.poolId, approvalForAllEvent), + // Block number is 0 because it is important to receive all approval events, + // so existing approvals will be reflected in the newly created pool '0', ), ]); @@ -295,7 +297,7 @@ export class TokensService { approved: dto.approved, data: encodeHex(dto.data ?? ''), }, - this.postOptions(dto.owner, dto.requestId), + this.postOptions(dto.signer, dto.requestId), ), ); return { id: response.data.id }; @@ -377,9 +379,6 @@ class TokenListener implements EventListener { process(msg); } break; - case approvalForAllEventSignature: - process(this.transformTokenCreateEvent(subName, event)); - break; default: this.logger.error(`Unknown event signature: ${event.signature}`); return undefined; diff --git a/test/app.e2e-spec.ts b/test/app.e2e-spec.ts index 233d762..ca6941f 100644 --- a/test/app.e2e-spec.ts +++ b/test/app.e2e-spec.ts @@ -347,7 +347,7 @@ describe('AppController (e2e)', () => { it('Token approval', async () => { const request: TokenApproval = { poolId: 'F1', - owner: IDENTITY, + signer: IDENTITY, operator: '2', approved: true, }; @@ -768,13 +768,6 @@ describe('AppController (e2e)', () => { name: TOPIC + ':N1', }); - http.get = jest.fn( - () => - new FakeObservable({ - output: 'firefly://token/{id}', - }), - ); - await server .ws('/api/ws') .exec(() => {