Skip to content

Commit

Permalink
Merge pull request #66 from kaleido-io/tokenevent
Browse files Browse the repository at this point in the history
Clean up blockchain info passed back to FireFly
  • Loading branch information
nguyer authored Apr 7, 2022
2 parents 58697d4 + 33bb2d9 commit f20ef98
Show file tree
Hide file tree
Showing 4 changed files with 329 additions and 239 deletions.
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
"start:prod": "node dist/src/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test": "npm run test:unit && npm run test:e2e",
"test:unit": "jest",
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
Expand Down
58 changes: 42 additions & 16 deletions src/tokens/tokens.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,40 +136,64 @@ export class TokenApproval {
config?: any;
}

export class BlockchainTransaction {
export class BlockLocator {
@ApiProperty()
@IsNotEmpty()
blockNumber: string;
}

export class BlockchainInfo extends BlockLocator {
@ApiProperty()
@IsNotEmpty()
transactionIndex: string;

@ApiProperty()
@IsNotEmpty()
transactionHash: string;

@ApiProperty()
@IsOptional() // only optional to support activating very old pools - TODO: remove eventually
logIndex: string;

@ApiProperty()
@IsOptional()
signature: string;

@ApiProperty()
@IsOptional()
address: string;
}

export class BlockchainEvent {
@ApiProperty()
id: string;

@ApiProperty()
name: string;

@ApiProperty()
output: any;

@ApiProperty()
info: BlockchainInfo;

@ApiProperty()
location: string;

@ApiProperty()
signature: string;

@ApiProperty()
timestamp: string;
}

export class TokenPoolActivate {
@ApiProperty()
@IsNotEmpty()
poolId: string;

@ApiProperty()
@IsOptional()
transaction?: BlockchainTransaction;
config?: any;

@ApiProperty()
@IsOptional()
locator?: BlockLocator;

@ApiProperty({ description: requestIdDescription })
@IsOptional()
Expand Down Expand Up @@ -245,19 +269,15 @@ class tokenEventBase {
data?: string;

@ApiProperty()
transaction: BlockchainTransaction;

@ApiProperty()
timestamp: string;

@ApiProperty()
rawOutput: any;
blockchain: BlockchainEvent;
}

export class TokenPoolEventInfo {
@ApiProperty()
location?: string;
address: string;

@ApiProperty()
signature?: string;
typeId: string;
}

export class TokenPoolEvent extends tokenEventBase {
Expand All @@ -266,6 +286,12 @@ export class TokenPoolEvent extends tokenEventBase {

@ApiProperty()
standard: string;

@ApiProperty()
symbol?: string;

@ApiProperty()
info: TokenPoolEventInfo;
}

export class TokenTransferEvent extends tokenEventBase {
Expand Down
Loading

0 comments on commit f20ef98

Please sign in to comment.