Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add staking claim types #199

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/types/decoded-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export enum ConfirmationViewTypes {
COW_SWAP_TWAP_ORDER = 'COW_SWAP_TWAP_ORDER',
KILN_NATIVE_STAKING_DEPOSIT = 'KILN_NATIVE_STAKING_DEPOSIT',
KILN_NATIVE_STAKING_VALIDATORS_EXIT = 'KILN_NATIVE_STAKING_VALIDATORS_EXIT',
KILN_NATIVE_STAKING_WITHDRAW = 'KILN_NATIVE_STAKING_WITHDRAW',
}

export type DecodedDataRequest = {
Expand Down Expand Up @@ -106,9 +107,18 @@ export type NativeStakingValidatorsExitConfirmationView = {
tokenInfo: TokenInfo
} & DecodedDataResponse

export type NativeStakingWithdrawConfirmationView = {
/** @enum {string} */
type: ConfirmationViewTypes.KILN_NATIVE_STAKING_WITHDRAW
value: string
rewards: string
tokenInfo: TokenInfo
} & DecodedDataResponse

export type AnyStakingConfirmationView =
| NativeStakingDepositConfirmationView
| NativeStakingValidatorsExitConfirmationView
| NativeStakingWithdrawConfirmationView

/* Union */
export type AnyConfirmationView =
Expand All @@ -117,3 +127,4 @@ export type AnyConfirmationView =
| TwapOrderConfirmationView
| NativeStakingDepositConfirmationView
| NativeStakingValidatorsExitConfirmationView
| NativeStakingWithdrawConfirmationView
14 changes: 12 additions & 2 deletions src/types/transactions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import type { AddressEx, Page, TokenInfo } from './common'
import type { NativeStakingDepositConfirmationView, NativeStakingValidatorsExitConfirmationView } from './decoded-data'
import type {
NativeStakingDepositConfirmationView,
NativeStakingValidatorsExitConfirmationView,
NativeStakingWithdrawConfirmationView,
} from './decoded-data'
import type { RichDecodedInfo } from './human-description'

export type ParamValue = string | ParamValue[]
Expand Down Expand Up @@ -74,6 +78,7 @@ export enum TransactionInfoType {
SWAP_TRANSFER = 'SwapTransfer',
NATIVE_STAKING_DEPOSIT = 'NativeStakingDeposit',
NATIVE_STAKING_VALIDATORS_EXIT = 'NativeStakingValidatorsExit',
NATIVE_STAKING_WITHDRAW = 'NativeStakingWithdraw',
}

export enum ConflictType {
Expand Down Expand Up @@ -351,7 +356,12 @@ export type StakingTxExitInfo = {
humanDescription?: string
} & Omit<NativeStakingValidatorsExitConfirmationView, 'type'>

export type StakingTxInfo = StakingTxDepositInfo | StakingTxExitInfo
export type StakingTxWithdrawInfo = {
type: TransactionInfoType.NATIVE_STAKING_WITHDRAW
humanDescription?: string
} & Omit<NativeStakingWithdrawConfirmationView, 'type'>

export type StakingTxInfo = StakingTxDepositInfo | StakingTxExitInfo | StakingTxWithdrawInfo

export type TransactionInfo =
| Transfer
Expand Down
Loading