forked from PolymeshAssociation/polymesh-rest-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 🎸 add verify+affirm endpoint and allow amount for verify
allow users to affirm and verify confidential transaction in a single call and also allow amounts to be passed when using /verify-amounts
- Loading branch information
1 parent
cb7c8d7
commit c135fd1
Showing
9 changed files
with
529 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
src/confidential-proofs/dto/auditor-verify-transaction.dto.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* istanbul ignore file */ | ||
|
||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { BigNumber } from '@polymeshassociation/polymesh-private-sdk'; | ||
import { Type } from 'class-transformer'; | ||
import { IsArray, ValidateNested } from 'class-validator'; | ||
|
||
import { ConfidentialLegAmountDto } from '~/confidential-transactions/dto/confidential-leg-amount.dto'; | ||
import { ToBigNumber } from '~/polymesh-rest-api/src/common/decorators/transformation'; | ||
import { IsBigNumber } from '~/polymesh-rest-api/src/common/decorators/validation'; | ||
|
||
export class LegAmountsDto { | ||
@ApiProperty({ | ||
description: 'The leg ID the amounts are for', | ||
type: 'string', | ||
example: '1', | ||
}) | ||
@IsBigNumber() | ||
@ToBigNumber() | ||
legId: BigNumber; | ||
|
||
@ApiProperty({ | ||
description: 'Expected amounts for each of the assets in the leg', | ||
type: ConfidentialLegAmountDto, | ||
isArray: true, | ||
}) | ||
@IsArray() | ||
@ValidateNested({ each: true }) | ||
@Type(() => ConfidentialLegAmountDto) | ||
expectedAmounts: ConfidentialLegAmountDto[]; | ||
} |
29 changes: 29 additions & 0 deletions
29
src/confidential-proofs/dto/verify-transaction-amounts.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* istanbul ignore file */ | ||
|
||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; | ||
import { Type } from 'class-transformer'; | ||
import { IsArray, IsOptional, IsString, ValidateNested } from 'class-validator'; | ||
|
||
import { LegAmountsDto } from '~/confidential-proofs/dto/leg-amounts.dto'; | ||
|
||
export class VerifyTransactionAmountsDto { | ||
@ApiProperty({ | ||
description: | ||
'The public key to decrypt transaction amounts for. Any leg with a provided sender proof involving this key as auditor or a receiver will be verified. The corresponding private key must be present in the proof server', | ||
type: 'string', | ||
example: '0x7e9cf42766e08324c015f183274a9e977706a59a28d64f707e410a03563be77d', | ||
}) | ||
@IsString() | ||
readonly publicKey: string; | ||
|
||
@ApiPropertyOptional({ | ||
description: | ||
'The expected amounts for each leg. Providing an amount is more efficient for the proof server', | ||
isArray: true, | ||
}) | ||
@IsOptional() | ||
@IsArray() | ||
@ValidateNested({ each: true }) | ||
@Type(() => LegAmountsDto) | ||
readonly legAmounts?: LegAmountsDto[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.