-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Full support of sign transaction schema
- Loading branch information
1 parent
ad6ef6f
commit 5af2884
Showing
8 changed files
with
240 additions
and
75 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
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
12 changes: 12 additions & 0 deletions
12
apps/orchestration/src/policy-engine/http/rest/dto/sign-message-request.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,12 @@ | ||
import { ApiProperty } from '@nestjs/swagger' | ||
import { IsDefined, IsString } from 'class-validator' | ||
|
||
export class SignMessageRequestDto { | ||
@IsString() | ||
@IsDefined() | ||
@ApiProperty({ | ||
required: true, | ||
type: 'string' | ||
}) | ||
message: string | ||
} |
117 changes: 117 additions & 0 deletions
117
apps/orchestration/src/policy-engine/http/rest/dto/sign-transaction-request.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,117 @@ | ||
import { Address, Hex, TransactionType } from '@app/orchestration/policy-engine/core/type/domain.type' | ||
import { ApiProperty } from '@nestjs/swagger' | ||
import { Transform } from 'class-transformer' | ||
import { | ||
IsDefined, | ||
IsEnum, | ||
IsEthereumAddress, | ||
IsInt, | ||
IsNumber, | ||
IsOptional, | ||
IsString, | ||
Min, | ||
ValidateNested | ||
} from 'class-validator' | ||
|
||
class AccessListDto { | ||
@IsString() | ||
@IsDefined() | ||
@IsEthereumAddress() | ||
@Transform(({ value }) => value.toLowerCase()) | ||
@ApiProperty({ | ||
format: 'Address', | ||
required: true, | ||
type: 'string' | ||
}) | ||
address: Address | ||
|
||
@IsString() | ||
@ApiProperty({ | ||
format: 'Hexadecimal', | ||
isArray: true, | ||
required: true, | ||
type: 'string' | ||
}) | ||
storageKeys: Hex[] | ||
} | ||
|
||
export class SignTransactionRequestDto { | ||
@IsInt() | ||
@Min(1) | ||
@ApiProperty({ | ||
minimum: 1 | ||
}) | ||
chainId: number | ||
|
||
@IsString() | ||
@IsDefined() | ||
@IsEthereumAddress() | ||
@Transform(({ value }) => value.toLowerCase()) | ||
@ApiProperty({ | ||
format: 'address', | ||
type: 'string' | ||
}) | ||
from: Address | ||
|
||
@IsNumber() | ||
@Min(0) | ||
@ApiProperty({ | ||
minimum: 0 | ||
}) | ||
nonce: number | ||
|
||
@IsOptional() | ||
@ValidateNested() | ||
@ApiProperty({ | ||
isArray: true, | ||
required: false, | ||
type: AccessListDto | ||
}) | ||
accessList?: AccessListDto[] | ||
|
||
@IsString() | ||
@IsOptional() | ||
@ApiProperty({ | ||
format: 'hexadecimal', | ||
required: false, | ||
type: 'string' | ||
}) | ||
data?: Hex | ||
|
||
@IsOptional() | ||
@Transform(({ value }) => BigInt(value)) | ||
@ApiProperty({ | ||
format: 'bigint', | ||
required: false, | ||
type: 'string' | ||
}) | ||
gas?: bigint | ||
|
||
@IsString() | ||
@IsEthereumAddress() | ||
@IsOptional() | ||
@Transform(({ value }) => value.toLowerCase()) | ||
@ApiProperty({ | ||
format: 'address', | ||
required: false, | ||
type: 'string' | ||
}) | ||
to?: Address | null | ||
|
||
@IsEnum(TransactionType) | ||
@IsOptional() | ||
@ApiProperty({ | ||
enum: TransactionType, | ||
required: false | ||
}) | ||
type?: `${TransactionType}` | ||
|
||
@IsString() | ||
@IsOptional() | ||
@ApiProperty({ | ||
format: 'hexadecimal', | ||
required: false, | ||
type: 'string' | ||
}) | ||
value?: Hex | ||
} |
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.