-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 🎸 Add support for off-chain settlement legs
- Loading branch information
1 parent
b97e686
commit 08fea3f
Showing
33 changed files
with
1,335 additions
and
362 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
"Isin", | ||
"metatype", | ||
"nand", | ||
"offchain", | ||
"Permissioned", | ||
"polkadot", | ||
"Polymesh", | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* istanbul ignore file */ | ||
|
||
import { ApiPropertyOptional } from '@nestjs/swagger'; | ||
import { Type } from 'class-transformer'; | ||
import { IsOptional, ValidateNested } from 'class-validator'; | ||
|
||
import { TransactionBaseDto } from '~/common/dto/transaction-base-dto'; | ||
import { PortfolioDto } from '~/portfolios/dto/portfolio.dto'; | ||
import { OffChainAffirmationReceiptDto } from '~/settlements/dto/offchain-affirmation-receipt.dto'; | ||
|
||
export class AffirmInstructionDto extends TransactionBaseDto { | ||
@ApiPropertyOptional({ | ||
description: 'List of portfolios that the signer controls and wants to affirm the instruction', | ||
type: () => PortfolioDto, | ||
isArray: true, | ||
}) | ||
@IsOptional() | ||
@ValidateNested({ each: true }) | ||
@Type(() => PortfolioDto) | ||
readonly portfolios?: PortfolioDto[]; | ||
|
||
@ApiPropertyOptional({ | ||
description: | ||
'List of offchain receipts required for affirming offchain legs(if any) in the instruction', | ||
type: () => OffChainAffirmationReceiptDto, | ||
isArray: true, | ||
}) | ||
@IsOptional() | ||
@ValidateNested({ each: true }) | ||
@Type(() => OffChainAffirmationReceiptDto) | ||
readonly receipts?: OffChainAffirmationReceiptDto[]; | ||
} |
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 { IsTicker } from '~/common/decorators/validation'; | ||
|
||
export enum LegType { | ||
OFF_CHAIN = 'offchain', | ||
ON_CHAIN = 'onchain', | ||
} | ||
|
||
export class AssetLegDto { | ||
@ApiProperty({ | ||
description: 'Ticker of the Asset', | ||
example: 'TICKER', | ||
}) | ||
@IsTicker() | ||
readonly asset: string; | ||
|
||
@ApiProperty({ | ||
description: 'Indicator to know if the transfer is onchain or offchain', | ||
enum: LegType, | ||
type: 'string', | ||
example: LegType.ON_CHAIN, | ||
}) | ||
readonly type: LegType; | ||
|
||
constructor(dto: AssetLegDto) { | ||
Object.assign(this, dto); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* istanbul ignore file */ | ||
|
||
import { ApiPropertyOptional } from '@nestjs/swagger'; | ||
import { IsBoolean, IsOptional } from 'class-validator'; | ||
|
||
import { TransactionBaseDto } from '~/common/dto/transaction-base-dto'; | ||
|
||
export class ExecuteInstructionDto extends TransactionBaseDto { | ||
@ApiPropertyOptional({ | ||
description: 'Set to `true` to skip affirmation check, useful for batch transactions', | ||
type: 'boolean', | ||
example: false, | ||
}) | ||
@IsOptional() | ||
@IsBoolean() | ||
readonly skipAffirmationCheck?: boolean; | ||
} |
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,13 @@ | ||
/* istanbul ignore file */ | ||
|
||
import { BigNumber } from '@polymeshassociation/polymesh-sdk'; | ||
|
||
import { ToBigNumber } from '~/common/decorators/transformation'; | ||
import { IsBigNumber } from '~/common/decorators/validation'; | ||
import { IdParamsDto } from '~/common/dto/id-params.dto'; | ||
|
||
export class LegIdParamsDto extends IdParamsDto { | ||
@IsBigNumber() | ||
@ToBigNumber() | ||
readonly legId: BigNumber; | ||
} |
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.