-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
expose smart message in messages api
- Loading branch information
Showing
4 changed files
with
99 additions
and
0 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
89 changes: 89 additions & 0 deletions
89
packages/sdk/src/dialect-cloud-api/smart-message-spec.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,89 @@ | ||
export enum SmartMessageStateDto { | ||
Created = 'CREATED', | ||
ReadyForExecution = 'READY_FOR_EXECUTION', | ||
Executing = 'EXECUTING', | ||
Succeeded = 'SUCCEEDED', | ||
Failed = 'FAILED', | ||
Canceled = 'CANCELED', | ||
} | ||
|
||
export enum ActionType { | ||
SignTransaction = 'SIGN_TRANSACTION', | ||
OpenLink = 'OPEN_LINK', | ||
Cancel = 'CANCEL', // cancel without a transaction, in other words a noop | ||
} | ||
|
||
export class SmartMessageButtonLayoutElementDto { | ||
type!: 'button'; | ||
text!: string; | ||
action!: SmartMessageSpecActionDto; | ||
} | ||
|
||
export class SmartMessageLabelLayoutElementDto { | ||
type!: 'label'; | ||
text!: string; | ||
} | ||
|
||
export class SmartMessageSpecOpenLinkActionDto { | ||
type!: ActionType.OpenLink; | ||
link!: string; | ||
} | ||
|
||
export class SmartMessageSpecSignTransactionActionDto { | ||
humanReadableId!: string; | ||
type!: ActionType.SignTransaction; | ||
} | ||
|
||
export class SmartMessageSpecCancelActionDto { | ||
humanReadableId!: string; | ||
type!: ActionType.Cancel; | ||
} | ||
|
||
export type SmartMessageSpecActionDto = | ||
| SmartMessageSpecOpenLinkActionDto | ||
| SmartMessageSpecSignTransactionActionDto | ||
| SmartMessageSpecCancelActionDto; | ||
|
||
export type SmartMessageLayoutElementDto = | ||
| SmartMessageButtonLayoutElementDto | ||
| SmartMessageLabelLayoutElementDto; | ||
|
||
export class SmartMessageLayoutDto { | ||
icon!: string | null; | ||
description!: string | null; | ||
header!: string | null; | ||
subheader!: string | null; | ||
elements!: SmartMessageLayoutElementDto[][]; | ||
} | ||
|
||
export class SmartMessageContentDto { | ||
state!: SmartMessageStateDto; | ||
layout!: SmartMessageLayoutDto; | ||
} | ||
|
||
export class SmartMessagePreviewParamsDto { | ||
state!: SmartMessageStateDto; | ||
} | ||
|
||
export class SmartMessageSystemParamsDto { | ||
state!: SmartMessageStateDto; | ||
workflowStateHumanReadableId!: string; | ||
createdByWalletAddress!: string; | ||
principalWalletAddress!: string; | ||
updatedByWalletAddress!: string; | ||
} | ||
|
||
export class CreateSmartMessageTransactionCommandDto { | ||
account!: string; | ||
actionHumanReadableId!: string; | ||
} | ||
|
||
export class SmartMessageTransactionDto { | ||
transaction!: string; | ||
message?: string; | ||
} | ||
|
||
export class SubmitSmartMessageTransactionCommandDto { | ||
readonly transaction!: string; | ||
readonly actionHumanReadableId!: string; | ||
} |
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,6 @@ | ||
import type { SmartMessageContentDto } from './smart-message-spec.dto'; | ||
|
||
export class SmartMessageDto { | ||
id!: string; | ||
content!: SmartMessageContentDto; | ||
} |
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